[llvm] [VPlan] Fix packed replication of struct types (PR #160274)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 24 06:27:04 PDT 2025


================
@@ -3267,11 +3267,21 @@ 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:

Can you add a message here?

https://github.com/llvm/llvm-project/pull/160274


More information about the llvm-commits mailing list