[LLVMbugs] [Bug 913] instcombine misoptimizes shr+and to setgt

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Sep 15 20:17:14 PDT 2006


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

sabre at nondot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
           Keywords|                            |miscompilation
         OS/Version|Linux                       |All
           Platform|PC                          |All
         Resolution|                            |FIXED
   Target Milestone|---                         |1.9
            Version|trunk                       |1.7



------- Additional Comments From sabre at nondot.org  2006-09-15 22:17 -------
Fixed.  Testcase here: Transforms/InstCombine/2006-09-15-CastToBool.ll

Patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20060911/037892.html

BTW, instcombine now reduces the function in the testcase to:

int %test(int* %tmp1) {
        %tmp = load int* %tmp1          ; <int> [#uses=1]
        %tmp = cast int %tmp to uint            ; <uint> [#uses=1]
        %tmp2 = shr uint %tmp, ubyte 5          ; <uint> [#uses=1]
        %tmp2 = cast uint %tmp2 to int          ; <int> [#uses=1]
        %tmp34 = and int %tmp2, 1               ; <int> [#uses=1]
        ret int %tmp34
}

The shift is required because the function is required to deliver int 1/0, not a bool.

Thanks!

-Chris



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