[LLVMbugs] [Bug 1528] NEW: instcombine miscompiles lshr i32 %x, 31

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Jun 23 10:15:07 PDT 2007


           Summary: instcombine miscompiles lshr i32 %x, 31
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nicholas at mxc.ca

This is a reduction from SPASS. lshr(ptrtoint, bitwidth-1) seems to get
miscompiled by instcombine:

$ cat pr1528.ll

define i1 @foo(i32 %tmp1213) {
  %S.lobit.i.i = lshr i32 %tmp1213, 31
  %tmp3.i684 = icmp eq i32 %S.lobit.i.i, 0
  ret i1 %tmp3.i684

$ llvm-as < pr1528.ll | opt -instcombine | llvm-dis
; ModuleID = '<stdin>'

define i1 @foo(i32 %tmp1213) {
        %tmp3.i684 = icmp sgt i32 %tmp1213, -1          ; <i1> [#uses=1]
        ret i1 %tmp3.i684

If %tmp1213 is 4 then the original returns false while the post-instcombine code
returns true.

------- 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