[PATCH] D138873: [InstCombine] canonicalize trunc + insert as bitcast + shuffle, part 2

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 15:34:27 PST 2022


spatel created this revision.
spatel added reviewers: RKSimon, nikic, dmgreen, lebedev.ri.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: All.
spatel requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This enhances the base fold from part 1 to allow mapping a right-shift to an insert index.

Example of translating a middle chunk of the scalar to vector for either endian:
https://alive2.llvm.org/ce/z/fRXCOZ

This only allows creating an identity shuffle (with optional shortening/lengthening) because that is considered the safe baseline for any target (can be inverted if needed). If we tried this fold with target-specific costs/legality, then we could do the transform more generally.


https://reviews.llvm.org/D138873

Files:
  llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  llvm/test/Transforms/InstCombine/insert-trunc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138873.478380.patch
Type: text/x-patch
Size: 7377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221128/21544ad7/attachment-0001.bin>


More information about the llvm-commits mailing list