[LLVMbugs] [Bug 11514] New: Illegal DAG optimization for SHL of any extended value

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 8 15:50:49 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=11514

             Bug #: 11514
           Summary: Illegal DAG optimization for SHL of any extended value
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: hfinkel at anl.gov
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 7693
  --> http://llvm.org/bugs/attachment.cgi?id=7693
Failing input

%call = tail call i32 bitcast (i32 (...)* @__bswap32_var to i32 (i32)*)(i32 0)
nounwind
  %0 = zext i32 %call to i64
  %1 = shl nuw i64 %0, 32

is transformed to:

0x2485770: ch,glue = callseq_end 0x2485470, 0x2483350, 0x2485670, 0x2485570
[ORD=2]
0x2485970: i32,ch,glue = CopyFromReg 0x2485770, 0x2485870, 0x2485770:1 [ORD=2]
0x2485a70: i64 = zero_extend 0x2485970 [ORD=4]
0x2485c70: i32 = Constant<32> [ORD=5]
0x2485d70: i64 = shl 0x2485a70, 0x2485c70 [ORD=5]

which becomes:

0x3c278d0: i32,ch,glue = CopyFromReg 0x3c276d0, 0x3c277d0, 0x3c276d0:1 [ORD=2]
0x3c24fb0: i64 = any_extend 0x3c278d0
0x3c27bd0: i32 = Constant<32> [ORD=5]
0x3c27cd0: i64 = shl 0x3c24fb0, 0x3c27bd0 [ORD=5]

which becomes:

0x2485770: ch,glue = callseq_end 0x2485470, 0x2483350, 0x2485670, 0x2485570
[ORD=2] [ID=21]
0x2485970: i32,ch,glue = CopyFromReg 0x2485770, 0x2485870, 0x2485770:1 [ORD=2]
[ID=22]
0x2485c70: i32 = Constant<32> [ORD=5] [ID=9]
0x2486170: i32 = shl 0x2485970, 0x2485c70
0x2485a70: i64 = any_extend 0x2486170

but this transformation is not legal because the 32-bit shift cannot shift by
32 bits (31 is the maximum). The original 64-bit shift would have been fine,
but for some reason the shift was demoted from a 64-bit shift to a 32-bit
shift.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list