[PATCH] D31196: [InstCombine] fold insertelement of scalar constant into vector of constants

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 10:58:11 PDT 2017


spatel created this revision.
Herald added a subscriber: mcrosier.

Keeping the various operand names straight for a pair of insertelements is challenging. I've reused the existing code in the patch, but if I renamed those code variables, it might be something like this:
insertelement (insertelement VectorC, X, Idx1C), ScalarC, Idx0C --> insertelement NewVectorC, X, Idx1C

So we're putting the scalar constant from the 2nd instruction into the vector constant operand of the 1st instruction because that eliminates the 2nd insertelement.


https://reviews.llvm.org/D31196

Files:
  lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  test/Transforms/InstCombine/bitcast-bigendian.ll
  test/Transforms/InstCombine/insert-extract-shuffle.ll
  test/Transforms/InstCombine/vec_demanded_elts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31196.92511.patch
Type: text/x-patch
Size: 10045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170321/61b09da6/attachment.bin>


More information about the llvm-commits mailing list