[llvm-bugs] [Bug 30794] New: Missing pattern in instcombine

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 25 21:19:39 PDT 2016


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

            Bug ID: 30794
           Summary: Missing pattern in instcombine
           Product: new-bugs
           Version: 3.9
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mehdi.amini at apple.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Instcombine is turning `v < 0x4000000000000000 && v >= -0x4000000000000000`
into `v + 0x4000000000000000 > -1`.

This alone is fine, but is inhibiting other combine. For instance when v is
`sext i32 to i64`, the individual comparison are being folded away:

  icmp sgt i64 (sext i32 %0 to i64 ), -4611686018427387905.

And 

  icmp slt i64  (sext i32 %0 to i64 ), 4611686018427387904

However if the comparison are first combined, we get this pattern:

  %2 = sext i32 %0 to i64
  %3 = add i64 %2, 4611686018427387904

That instcombine does not reduce further.

(See also here:
http://stackoverflow.com/questions/40203127/why-doesnt-clang-llvm-optimize-this
)

-- 
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/20161026/dd629583/attachment.html>


More information about the llvm-bugs mailing list