[llvm-bugs] [Bug 32791] New: [InstCombine] fold or-of-selects with inverted predicates and zero operands

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 25 08:49:24 PDT 2017


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

            Bug ID: 32791
           Summary: [InstCombine] fold or-of-selects with inverted
                    predicates and zero operands
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org

This is a variation of an existing regression test in
test/Transforms/InstCombine/logical-select.ll:

define i32 @poo(i32 %a, i32 %b, i32 %c, i32 %d) {
  %cmp1 = icmp slt i32 %a, %b
  %sel1 = select i1 %cmp1, i32 %c, i32 0
  %cmp2 = icmp sge i32 %a, %b
  %sel2 = select i1 %cmp2, i32 %d, i32 0
  %or = or i32 %sel1, %sel2
  ret i32 %or
}

We should recognize the inverted predicates and disguised 'and' ops and fold
this to:

%cmp = icmp slt i32 %a, %b
%sel = select i1 %cmp, i32 %c, i32 %d

-- 
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/20170425/73cdb1a0/attachment.html>


More information about the llvm-bugs mailing list