[LLVMbugs] [Bug 1570] NEW: instcombine doesn't collapse zext/xor/zext

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Jul 24 21:16:54 PDT 2007


           Summary: instcombine doesn't collapse zext/xor/zext
           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

This function:

define i32 @test2(float %X, float %Y) {
        %tmp3 = fcmp uno float %X, %Y           ; <i1> [#uses=1]
        %tmp34 = zext i1 %tmp3 to i8            ; <i8> [#uses=1]
        %tmp = xor i8 %tmp34, 1         ; <i8> [#uses=1]
        %toBoolnot5 = zext i8 %tmp to i32               ; <i32> [#uses=1]
        ret i32 %toBoolnot5

could be optimized further. Instcombine should use its bitwise analysis to
collapse the zext/xor/zext structure to an xor/zext and then remove the xor by
reversing the fcmp.

Desired output:

define i32 @test2(float %X, float %Y) {
        %tmp3 = fcmp ord float %X, %Y           ; <i1> [#uses=1]
        %tmp34 = zext i1 %tmp3 to i32           ; <i32> [#uses=1]
        ret i32 %tmp34

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