[LLVMbugs] [Bug 4424] New: instcombine creates constexpr sdiv(0, x) instead of

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Jun 20 18:03:25 PDT 2009


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

           Summary: instcombine creates constexpr sdiv(0, x) instead of 0
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: nicholas at mxc.ca
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu


$ cat ~/tmp/constfold_missed.ll 
; ModuleID = '<stdin>'

declare void @ext()

define i32 @foo(i32 %ptr) {
entry:
        %zero = sub i32 %ptr, %ptr              ; <i32> [#uses=1]
        %div_zero = sdiv i32 %zero, ptrtoint (i32* getelementptr (i32* null,
i32 1) to i32)             ; <i32> [#uses=1]
        ret i32 %div_zero
}

$ llvm-as < ~/tmp/constfold_missed.ll |opt -instcombine|llvm-dis
; ModuleID = '<stdin>'

declare void @ext()

define i32 @foo(i32 %ptr) {
entry:
        ret i32 sdiv (i32 0, i32 ptrtoint (i32* getelementptr (i32* null, i32
1) to i32))
}


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