[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


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:

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.



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