[llvm] [VPlan] Simplify branch on False in VPlan transform (NFC). (PR #140409)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat May 31 05:17:47 PDT 2025


================
@@ -1185,6 +1185,16 @@ void VPIRPhi::execute(VPTransformState &State) {
   State.Builder.SetInsertPoint(Phi->getParent(), std::next(Phi->getIterator()));
 }
 
+void VPPhiAccessors::removeIncomingValueFor(VPBlockBase *IncomingBlock) const {
+  VPRecipeBase *R = const_cast<VPRecipeBase *>(getAsRecipe());
+  auto &Preds = R->getParent()->getPredecessors();
+  assert(R->getNumOperands() == Preds.size() &&
+         "Number of phi operands must match number of predecessors");
+  unsigned Position = std::distance(Preds.begin(), find(Preds, IncomingBlock));
+  R->getOperand(Position)->removeUser(*R);
+  R->removeOperand(Position);
----------------
fhahn wrote:

Yep, moved the removal also to `removeOperand`. I kept the name, as removing the operand requires also removing the user. Also documented the behavior.

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


More information about the llvm-commits mailing list