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

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Sep 15 18:00:47 PDT 2006


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

           Summary: instcombine misoptimizes shr+and to setgt
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nicholas at mxc.ca


The instruction combiner is making the following transformation:

        %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]
-       %tmp3 = and int %tmp2, 1                ; <int> [#uses=1]
-       %tmp3 = cast int %tmp3 to bool          ; <bool> [#uses=1]
-       %tmp34 = cast bool %tmp3 to int         ; <int> [#uses=1]
+       %tmp3 = setgt uint %tmp, 31             ; <bool> [#uses=1]
+       %tmp34 = cast bool %tmp3 to int         ; <int> [#uses=2]

simplifying "(x >> 5) & 1 != 0" into "x > 31". They are not the same; consider
64: 64 >> 5 = 2, 2 & 1 = 0. But 64 > 31.



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