[llvm-bugs] [Bug 40102] New: icmp eq/ne (and X, (neg X)), 0 not optimized to just icmp eq/ne X, 0

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 19 10:54:29 PST 2018


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

            Bug ID: 40102
           Summary: icmp eq/ne (and X, (neg X)), 0 not optimized to just
                    icmp eq/ne X, 0
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: craig.topper at gmail.com
                CC: llvm-bugs at lists.llvm.org

As mentioned in D55870, this can be optimized to just a compare of X with 0.

Test case taken from test/CodeGen/bmi.ll

define i32 @blsi32_z2(i32 %a, i32 %b, i32 %c) nounwind {
  %t0 = sub i32 0, %a
  %t1 = and i32 %t0, %a
  %t2 = icmp eq i32 %t1, 0
  %t3 = select i1 %t2, i32 %b, i32 %c
  ret i32 %t3
}

-- 
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/20181219/a1cf7ca1/attachment.html>


More information about the llvm-bugs mailing list