Boo

Inefficient IL for unary negations (especially negative floating-point literals)

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.8.2
  • Fix Version/s: 0.9
  • Component/s: Compiler
  • Labels:
    None
  • Number of attachments :
    0

Description

x as double = -1.0

Generates this:

ldc.r8 1.
ldc.i4 -1
conv.r8 
mul 
stloc.0

Instead of:

ldc.r8 -1.
stloc.0

x = -x (with x an int)

Generates this:

ldloc.0
ldc.i4 -1
mul 
stloc.0

Instead of:

ldc.i4.0
ldloc.0
sub.ovf
stloc.0

Or even (for unchecked blocks and any single/double):

ldloc.0
neg
stloc.0

Activity

Hide
Cedric Vivier added a comment -

Fixed in rev. 3103

Show
Cedric Vivier added a comment - Fixed in rev. 3103

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: