[llvm-bugs] [Bug 31770] New: [InstCombine] fold extractelt(trunc(bitcast X))) -> extractelt

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 26 09:09:12 PST 2017


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

            Bug ID: 31770
           Summary: [InstCombine] fold extractelt(trunc(bitcast X))) ->
                    extractelt
           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

We're missing a vector fold as Zvi noted here:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/109539.html

define i32 @B(<8 x i32> %V) {
   %B = bitcast <8 x i32> %V to <4 x i64>
   %T = trunc <4 x i64> %B to <4 x i32>
   %E = extractelement <4 x i32> %T, i32 1
   ret i32 %E
}

On little-endian, this should be:
define i32 @B(<8 x i32> %V) {
  %E = extractelement <8 x i32> %V, i32 2
  ret i32 %E
}

There's a similar-looking fold already in InstCombine called
"foldVecTruncToExtElt()".

-- 
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/20170126/9b5d8a08/attachment.html>


More information about the llvm-bugs mailing list