[PATCH] D73892: [SelectionDAG] Optimize build_vector of truncates and shifts

Sebastian Neubauer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 3 07:24:56 PST 2020


sebastian-ne created this revision.
sebastian-ne added a reviewer: bogner.
Herald added subscribers: llvm-commits, kerbowa, hiraditya, jvesely.
Herald added a project: LLVM.

Add a simplification to fuse a manual vector extract with shifts and
truncate into a bitcast.

Unpacking and packing values into vectors is only optimized with
extractelement instructions, not when manually unpacked using shifts
and truncates.
This patch simplifies shifts and truncates into a bitcast if possible.

Simplify (build_vec (trunc $1)

  (trunc (srl $1 width))
  (trunc (srl $1 (2 * width))) ...)

to (bitcast $1)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73892

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/AMDGPU/scalar_to_vector.ll
  llvm/test/CodeGen/AMDGPU/vector_shuffle.packed.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73892.242067.patch
Type: text/x-patch
Size: 7128 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200203/91856679/attachment.bin>


More information about the llvm-commits mailing list