[llvm] [SLP]Remove emission of vector_insert/vector_extract intrinsics (PR #148007)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 11 07:18:29 PDT 2025
================
@@ -16296,6 +16288,27 @@ Value *BoUpSLP::gather(
if (auto *SI = dyn_cast<Instruction>(Scalar))
UserOp = SI;
} else {
+ if (V->getType()->isVectorTy()) {
+ if (auto *SV = dyn_cast<ShuffleVectorInst>(InsElt);
+ SV && SV->getOperand(0) != V && SV->getOperand(1) != V) {
+ // Find shufflevector, caused by resize.
+ auto FindOperand = [&](Value *Vec, Value *V) -> Instruction * {
+ if (auto *SV = dyn_cast<ShuffleVectorInst>(Vec)) {
+ if (SV->getOperand(0) == V)
+ return SV;
+ if (SV->getOperand(1) == V)
+ return SV;
+ }
+ return nullptr;
+ };
+ if (Instruction *User = FindOperand(SV->getOperand(0), V))
+ InsElt = User;
+ else if (Instruction *User = FindOperand(SV->getOperand(1), V))
+ InsElt = User;
+ assert(InsElt &&
----------------
RKSimon wrote:
How can InsElt be null here? its already dereferenced as InsElt->getParent() above - we need a better way to ensure we found the matching inner shuffle.
https://github.com/llvm/llvm-project/pull/148007
More information about the llvm-commits
mailing list