[llvm] [VPlan] Don't replicate extractvalues that would require extracting lanes from a struct (PR #219941)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 03:54:33 PDT 2026


================
@@ -6445,6 +6431,14 @@ VPRecipeBuilder::tryToCreateWidenNonPhiRecipe(VPSingleDefRecipe *R,
                        VPI->getOpcode()) &&
          "Should have been handled prior to this!");
 
+  // We can only replicate an extractvalue if its operand generates per lane in
+  // the same replicate region.
+  if (VPI->getOpcode() == Instruction::ExtractValue)
+    if (VPRecipeBase *OpR = VPI->getOperand(0)->getDefiningRecipe())
+      if (!vputils::doesGeneratePerAllLanes(OpR) ||
+          OpR->getParent() != VPI->getParent())
----------------
lukel97 wrote:

Replicate regions haven't been created yet at this point. This is before createAndOptimizeReplicateRegions

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


More information about the llvm-commits mailing list