[PATCH] D34077: DAGCombine: Combine BUILD_VECTOR to TRUNCATE

Zvi Rackover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 10 00:59:05 PDT 2017


zvi created this revision.
Herald added a subscriber: javed.absar.

Add a combine for creating a truncate to replace a build_vector composed of extracts with
indices that form a stride-2^N series.

Example:
v8i32 V = ...

v4i32 build_vector((extract_elt V, 0), (extract_elt V, 2), (extract_elt V, 4), (extract_elt V, 6))
-->
v4i32 truncate (bitcast V to v4i64)

Related discussion in llvm-dev about canonicalizing shuffles to
truncates in LLVM IR:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/108936.html.


https://reviews.llvm.org/D34077

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/ARM/vext.ll
  test/CodeGen/ARM/vpadd.ll
  test/CodeGen/ARM/vuzp.ll
  test/CodeGen/X86/shuffle-vs-trunc-256.ll
  test/CodeGen/X86/shuffle-vs-trunc-512.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34077.102108.patch
Type: text/x-patch
Size: 55441 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170610/53d734c5/attachment-0001.bin>


More information about the llvm-commits mailing list