[llvm-bugs] [Bug 43261] New: [InstCombine] Failure to simplify 2 icmp and select after rL369840

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 9 17:01:01 PDT 2019


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

            Bug ID: 43261
           Summary: [InstCombine] Failure to simplify 2 icmp and select
                    after rL369840
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: denis.bakhvalov at intel.com
                CC: llvm-bugs at lists.llvm.org

Before rL369840 we simplified the following case:

  %tmp = add i32 %i, -3
  %tmp1 = icmp ult i32 %tmp, 2
  %cmp2 = icmp eq i32 %i, 5
  %phitmp = zext i1 %cmp2 to i32
  %tmp2 = select i1 %tmp1, i32 1, i32 %phitmp

to

  %tmp = add i32 %i, -3
  %0 = icmp ult i32 %tmp, 3
  %tmp2 = zext i1 %0 to i32

Proof: https://rise4fun.com/Alive/dhoe

There were 4 steps of simplification:
step1&2: https://rise4fun.com/Alive/82o
step3&4: https://rise4fun.com/Alive/Izp

After rL369840 we invert the first comparison (icmp ult -> ugt, as a result of
tryToReuseConstantFromSelectInComparison() ) and instcombine takes another
route.

I'm not sure if it is a duplicate of recently created bug for InstCombine.

-- 
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/20190910/992d5629/attachment.html>


More information about the llvm-bugs mailing list