[llvm-bugs] [Bug 28556] New: [InstCombine] SimplifyDemandedBits makes suboptimal transform

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 14 13:43:37 PDT 2016


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

            Bug ID: 28556
           Summary: [InstCombine] SimplifyDemandedBits makes suboptimal
                    transform
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

define i5 @or_3_or_1(i3 %a) {
  %or1 = or i3 %a, 3
  %z = zext i3 %or1 to i5
  %or2 = or i5 %z, 1
  ret i5 %or2
}

The 2nd 'or' is covered by the 1st, but SimplifyDemandedBits calls
ShrinkDemandedConstant and causes this:

$ ./opt -instcombine -S sandwiches.ll 

define i5 @or_3_or_1(i3 %a) {
  %or1 = or i3 %a, 2      <--- shrink constant causing later 'or' to be needed
  %z = zext i3 %or1 to i5
  %or2 = or i5 %z, 1
  ret i5 %or2
}

I don't know if this is working as intended or if this is a bug.

-- 
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/20160714/2c6d3884/attachment.html>


More information about the llvm-bugs mailing list