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

via llvm-commits llvm-commits at lists.llvm.org
Fri May 30 13:44:56 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);
----------------
ayalz wrote:

Good to keep these two changes atomic, taking care of both ends when removing an edge from def/use graph. Perhaps `removeOperandAndUser`?

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


More information about the llvm-commits mailing list