[LLVMbugs] [Bug 600] NEW: Legalize should signed extend this constant

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Jul 20 22:40:00 PDT 2005


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=600

           Summary: Legalize should signed extend this constant
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: alenhar2 at uiuc.edu


In the following code, -1 is extended from an i32 to an i64 as it should be, but
in doing so it is zero extended.  This makes a constant that cannot be loaded in
an efficient way and is spilled to memory.  It would be better to sign extend
both argumenets to the add.

; ModuleID = 'err.bc'
target endian = little
target pointersize = 64
target triple = "alphaev67-unknown-linux-gnu"
deplibs = [ "c", "crtend" ]

implementation   ; Functions:

int %foo(int %x) {
entry:
        %tmp.1 = add int %x, -1         ; <int> [#uses=1]
        ret int %tmp.1
}



gcc gives:
        subl $16,1,$0
        ret $31,($26),1

we give:
$CPIfoo_0:                                      # ulong 4294967295
        .quad   4294967295
...
        ldah $0,$CPIfoo_0($29) !gprelhigh
        ldq $0,$CPIfoo_0($0) !gprellow
        addl $16,$0,$0
        ret $31,($26),1

clearly i32 -1 is an important constant to be doing bad things too.  This is a
regression as at some point Legalize did the correct thing.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




More information about the llvm-bugs mailing list