[llvm] [SLP][REVEC] Make ShuffleCostEstimator and ShuffleInstructionBuilder can vectorize vector instructions. (PR #99499)
Han-Kuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 18:03:36 PDT 2024
================
@@ -11641,10 +11642,20 @@ Value *BoUpSLP::gather(ArrayRef<Value *> VL, Value *Root, Type *ScalarTy) {
V, Ty, !isKnownNonNegative(Scalar, SimplifyQuery(*DL)));
}
- Vec = Builder.CreateInsertElement(Vec, Scalar, Builder.getInt32(Pos));
- auto *InsElt = dyn_cast<InsertElementInst>(Vec);
- if (!InsElt)
- return Vec;
+ Instruction *InsElt;
+ if (auto *VecTy = dyn_cast<FixedVectorType>(Scalar->getType())) {
+ Vec = InsElt = Builder.CreateInsertVector(
+ Vec->getType(), Vec, V,
+ Builder.getInt64(Pos * VecTy->getNumElements()));
+ auto *II = dyn_cast<IntrinsicInst>(InsElt);
+ if (!(II && II->getIntrinsicID() == Intrinsic::vector_insert))
+ return Vec;
+ } else {
----------------
HanKuanChen wrote:
The else is for `FixedVectorType`. Or are you saying that it always returns `Intrinsic::vector_insert`?
https://github.com/llvm/llvm-project/pull/99499
More information about the llvm-commits
mailing list