[LLVMbugs] [Bug 1940] New: instcombine doesn't fold sgt(zext, zext) into ugt

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jan 21 16:29:51 PST 2008


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

           Summary: instcombine doesn't fold sgt(zext, zext) into ugt
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nicholas at mxc.ca
                CC: llvmbugs at cs.uiuc.edu


define i1 @test(i8 %A, i8 %B) {
        %a = zext i8 %A to i32
        %b = zext i8 %B to i32
        %c = icmp sgt i32 %a, %b
        ret i1 %c
}

should become:

define i1 @test(i8 %A, i8 %B) {
        %c = icmp ugt i32 %A, %B
        ret i1 %c
}

Similarly with the other compare-ops. The ugt(sext, sext) case should be
optimized by removing the sext's.

define i1 @test(i8 %A, i8 %B) {
        %a = sext i8 %A to i32
        %b = sext i8 %B to i32
        %c = icmp ugt i32 %a, %b
        ret i1 %c
}

should become:

define i1 @test(i8 %A, i8 %B) {
        %c = icmp ugt i32 %A, %B
        ret i1 %c
}


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