This is an archive of the discontinued LLVM Phabricator instance.

DAGCombine: Combine BUILD_VECTOR to TRUNCATE
AbandonedPublic

Authored by zvi on Jun 10 2017, 12:41 AM.

Details

Summary

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:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/108936.html.