[llvm-bugs] [Bug 52406] New: [InstCombine] try to thread binop through select-of-constants

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 4 08:45:02 PDT 2021


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

            Bug ID: 52406
           Summary: [InstCombine] try to thread binop through
                    select-of-constants
           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

Forking this off from bug 52402 (it doesn't involve multiplication magic):

define i8 @src(i8 %x, i1 %b) {
  %t4 = and i8 %x, 8
  %t7 = select i1 %b, i8 7, i8 0
  %t8 = shl i8 %t4, %t7
  ret i8 %t8
}

define i8 @tgt(i8 %x, i1 %b) {
  %t4 = and i8 %x, 8
  %r = select i1 %b, i8 0, i8 %t4
  ret i8 %r
}

https://alive2.llvm.org/ce/z/zw2px6

It probably does not make sense in general to pull the binop into the select -
we need to be able to simplify both sides of the select to justify this. This
might involve checking if one of the select operands is an identity constant
(ConstantExpr::getBinOpIdentity).

-- 
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/20211104/8b16e166/attachment-0001.html>


More information about the llvm-bugs mailing list