[PATCH] D76727: [VectorCombine] transform bitcasted shuffle to narrower elements

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 12:29:33 PDT 2020


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

LG



================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:248
 
+static bool foldBitcastShuf(Instruction &I, const TargetTransformInfo &TTI) {
+  Value *V;
----------------
It may be useful to prefix the function[s] with a
short blurb explaining what happens here,
what pattern we strive to replace with what pattern.


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:287-288
+  SmallVector<Constant *, 16> NewMaskC;
+  for (unsigned i = 0; i != DestNumElts; ++i)
+    NewMaskC.push_back(Builder.getInt32(NewMask[i]));
+  Value *Shuf = Builder.CreateShuffleVector(CastV, UndefValue::get(DestTy),
----------------
```
  NewMaskC.reserve(NewMask.size());
  for (int NewMaskElt : NewMask)
    NewMaskC.push_back(Builder.getInt32(NewMaskElt));
```



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76727/new/

https://reviews.llvm.org/D76727





More information about the llvm-commits mailing list