[PATCH] D79171: [InstCombine] canonicalize bitcast after insertelement into undef

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 00:30:10 PDT 2020


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

LG in general, but MMX stuff puzzles me, so would be good for @craig.topper to comment.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:2487-2488
   if (VectorType *DestVTy = dyn_cast<VectorType>(DestTy)) {
-    if (DestVTy->getNumElements() == 1 && !SrcTy->isVectorTy()) {
+    // Beware: messing with this target-specific oddity will cause trouble.
+    if (DestVTy->getNumElements() == 1 && SrcTy->isX86_MMXTy()) {
       Value *Elem = Builder.CreateBitCast(Src, DestVTy->getElementType());
----------------
Am i reading this correctly that this is NFC in context of rG5ebbabc1af360756f402203ba7704bb480f279a7?
Can this be split off?


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:1035
+    Type *ScalarTy = ScalarSrc->getType();
+    Type *VecTy = VectorType::get(ScalarTy, IE.getType()->getElementCount());
+    UndefValue *NewUndef = UndefValue::get(VecTy);
----------------
I guess this won't work for scalable vectors?
Can we somehow just replace the elt type in `VecOp->getType()` instead?


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

https://reviews.llvm.org/D79171





More information about the llvm-commits mailing list