[LLVMbugs] [Bug 9343] New: top 10 missed optimizations at -O2

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Feb 27 18:31:27 PST 2011


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

           Summary: top 10 missed optimizations at -O2
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nicholas at mxc.ca
                CC: baldrick at free.fr, llvmbugs at cs.uiuc.edu


This is a list of the top ten missed optimizations seen in bitcode after -O2,
sorted by popularity (number of sites in which they occurred, not number of
times they run in a program).

define i1 @test1(i32 %X, i32 %Y) {
; CHECK: test1
; CHECK-NOT: %Y
  %A = ashr exact i32 %X, %Y
  %B = icmp eq i32 %A, 0
; CHECK %B = icmp eq i32 %X, 0
  ret i1 %B
}

define i1 @test2(i32 %X, i32 %Y) {
; CHECK: test2
; CHECK-NOT: %Y
  %A = ashr exact i32 %X, %Y
  %B = sub i32 0, %A
; CHECK: %b = sub i32 0, %X
  %C = icmp sgt i32 %B, -1
  ret i1 %C
}

define i1 @test3(i32 %X, i32 %Y) {
; CHECK: test3
  %A = urem i32 %X, %Y
  %B = icmp ugt i32 %Y, %A
  ret i1 %B
; CHECK: ret i1 true
}

define i1 @test4(i32 %X, i32 %Y, i32 %Z) {
; CHECK: test4
; CHECK-NOT: %Z
  %A = ashr exact i32 %X, %Z
  %B = ashr exact i32 %Y, %Z
  %C = icmp ult i32 %A, %B
; CHECK: %C = icmp ult i32 %X, %Y
  ret i1 %C
}

define i1 @test5(i32 %X, i32 %Y, i32 %Z) {
; CHECK: test5
; CHECK-NOT: %Z
  %A = ashr exact i32 %X, %Z
  %B = ashr exact i32 %Y, %Z
  %C = icmp ugt i32 %A, %B
; CHECK: %C = icmp ugt i32 %X, %Y
  ret i1 %C
}

define i1 @test6(i32 %X, i32 %Y) {
; CHECK: test6
; CHECK-NOT: %B
; CHECK-NOT: %C
  %A = icmp ult i32 %X, %Y
  %B = icmp ne i32 %Y, 0
  %C = and i1 %A, %B
; CHECK: ret i1 %A
  ret i1 %C
}

define i1 @test7(i31 %X, i32 %Y) {
; CHECK: test7
  %A = zext i31 %X to i32
  %B = srem i32 %A, %Y
  %C = icmp slt i32 %B, 0
; CHECK: ret i1 false
  ret i1 %C
}

define i1 @test8(i32 %X, i32 %Y, i32 %Z) {
; CHECK: test8
; CHECK-NOT: %Z
  %A = sdiv exact i32 %X, %Z
  %B = sdiv exact i32 %Y, %Z
; CHECK: %C = icmp eq i32 %X, %Y
  %C = icmp eq i32 %A, %B
  ret i1 %C
}

define i1 @test9(i32 %X, i32 %Y) {
; CHECK: test9
; CHECK-NOT: %Y
  %A = add i32 %X, -1
  %B = and i32 %A, %Y
; CHECK: %C = icmp ugt i32 %X, %A
  %C = icmp ugt i32 %X, %B
  ret i1 %C
}

define i1 @test10(i31 %X, i31 %Y, i32 %Z) {
; CHECK: test10
; CHECK-NOT: %Z
  %A = zext i31 %X to i32
  %B = shl nuw i32 %A, %Z
  %C = zext i31 %Y to i32
; CHECK: %D = or i32 %A, %C
  %D = or i32 %B, %C
  %E = icmp eq i32 %D, 0
  ret i1 %E
}

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