[llvm-bugs] [Bug 31175] [AArch64] unnecessary cmp instruction with subtract and conditional select

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 14 15:05:21 PST 2016


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

Sanjay Patel <spatel+llvm at rotateright.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Sanjay Patel <spatel+llvm at rotateright.com> ---
Should be fixed after:
https://reviews.llvm.org/rL289738

This solves the only problem I've seen when trying to canonicalize the min/max
IR pattern:
define i32 @max(i32 %x, i32 %y) {
  %sub = sub nsw i32 %x, %y
  %cmp = icmp sgt i32 %x, %y
  %sel = select i1 %cmp, i32 %sub, i32 0
  ret i32 %sel
}

to:
define i32 @max(i32 %x, i32 %y) {
  %sub = sub nsw i32 %x, %y
  %cmp = icmp sgt i32 %sub, 0
  %sel = select i1 %cmp, i32 %sub, i32 0
  ret i32 %sel
}

-- 
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/20161214/835f5089/attachment.html>


More information about the llvm-bugs mailing list