[llvm-bugs] [Bug 42691] New: Combining comparisons to add and compare

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 19 11:25:02 PDT 2019


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: unassignedbugs at nondot.org
          Reporter: nikita.ppv at gmail.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190719/73a8fb3a/attachment.html>


More information about the llvm-bugs mailing list