[llvm-bugs] [Bug 24942] New: [instcombine] vector math/logic doesn't get the same bitwise optimizations as scalar

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 25 13:01:53 PDT 2015


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

            Bug ID: 24942
           Summary: [instcombine] vector math/logic doesn't get the same
                    bitwise optimizations as scalar
           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

Hole in SimplifyDemandedBits, computeKnownBits, or something else?

"31" and "2" don't have any special meaning here; lots of other constant pairs
could illustrate the same point:

define i32 @lshr_and_i32(i32 %x) {
  %lshr = lshr i32 %x, 31
  %and = and i32 %lshr, 2
  ret i32 %and
}

define <2 x i32> @lshr_and_v2i32(<2 x i32> %x) {
  %lshr = lshr <2 x i32> %x, <i32 31, i32 31>
  %and = and <2 x i32> %lshr, <i32 2, i32 2>
  ret <2 x i32> %and
}

$ ./opt -instcombine demand.ll -S 

define i32 @lshr_and_i32(i32 %x) {
  ret i32 0
}

define <2 x i32> @lshr_and_v2i32(<2 x i32> %x) {
  %lshr = lshr <2 x i32> %x, <i32 31, i32 31>
  %and = and <2 x i32> %lshr, <i32 2, i32 2>
  ret <2 x i32> %and
}

-- 
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/20150925/934b3006/attachment.html>


More information about the llvm-bugs mailing list