https://bugs.llvm.org/show_bug.cgi?id=42691

            Bug ID: 42691
           Summary: Combining comparisons to add and compare
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: nikita....@gmail.com
                CC: llvm-bugs@lists.llvm.org

define i1 @test(i32 %x) {
  %c1 = icmp slt i32 %x, 0
  %c2 = icmp eq i32 %x, 2147483647
  %c = or i1 %c1, %c2
  ret i1 %c
}

could be combined to

define i1 @test(i32 %x) {
  %y = add i32 %x, 1
  %c = icmp slt i32 %y, 1
  ret i1 %c
}

which is especially profitable if the add is already being computed for other
reasons.

https://rise4fun.com/Alive/GFm

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to