[llvm] [VPlan] Fix packed replication of struct types (PR #160274)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 25 01:16:09 PDT 2025
================
@@ -3267,11 +3267,23 @@ void VPPredInstPHIRecipe::execute(VPTransformState &State) {
// also do that packing, thereby "hoisting" the insert-element sequence.
// Otherwise, a phi node for the scalar value is needed.
if (State.hasVectorValue(getOperand(0))) {
- Value *VectorValue = State.get(getOperand(0));
- InsertElementInst *IEI = cast<InsertElementInst>(VectorValue);
- PHINode *VPhi = State.Builder.CreatePHI(IEI->getType(), 2);
- VPhi->addIncoming(IEI->getOperand(0), PredicatingBB); // Unmodified vector.
- VPhi->addIncoming(IEI, PredicatedBB); // New vector with inserted element.
+ auto *VecI = cast<Instruction>(State.get(getOperand(0)));
+ assert(isa<InsertElementInst>(VecI) ||
+ isa<InsertValueInst>(VecI) &&
----------------
fhahn wrote:
```suggestion
assert(isa<InsertElementInst, InsertValueInst>(VecI) &&
```
should be able to combine the isa<> I htink
https://github.com/llvm/llvm-project/pull/160274
More information about the llvm-commits
mailing list