[llvm] [VPlan] Handle extracts for middle blocks also used by early exiting blocks. NFC (PR #181789)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 20 08:14:48 PST 2026


================
@@ -1723,6 +1709,16 @@ VPPhiAccessors::getIncomingValueForBlock(const VPBasicBlock *VPBB) const {
   llvm_unreachable("VPBB is not an incoming block");
 }
 
+void VPPhiAccessors::setIncomingValueForBlock(const VPBasicBlock *VPBB,
+                                              VPValue *V) const {
+  for (unsigned Idx = 0; Idx != getNumIncoming(); ++Idx)
+    if (getIncomingBlock(Idx) == VPBB) {
+      const_cast<VPRecipeBase *>(getAsRecipe())->setOperand(Idx, V);
+      return;
+    }
+  llvm_unreachable("VPBB is not an incoming block");
----------------
fhahn wrote:

could we share the logic to retrieve the index for the incoming block with `getIncomingValueForBlock`?

Maybe this could just use `getIndexForPredecessor`?

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


More information about the llvm-commits mailing list