[llvm] [VPlan] Add VPPhiAccessors to provide interface for phi recipes (NFC) (PR #129388)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 10:40:14 PDT 2025


================
@@ -2890,11 +2890,8 @@ void InnerLoopVectorizer::fixNonInductionPHIs(VPTransformState &State) {
       PHINode *NewPhi = cast<PHINode>(State.get(VPPhi));
       // Make sure the builder has a valid insert point.
       Builder.SetInsertPoint(NewPhi);
-      for (unsigned Idx = 0; Idx < VPPhi->getNumOperands(); ++Idx) {
-        VPValue *Inc = VPPhi->getIncomingValue(Idx);
-        VPBasicBlock *VPBB = VPPhi->getIncomingBlock(Idx);
+      for (const auto &[Inc, VPBB] : VPPhi->incoming_values_and_blocks())
         NewPhi->addIncoming(State.get(Inc), State.CFG.VPBB2IRBB[VPBB]);
-      }
----------------
fhahn wrote:

There will be additional users when updating more recipes to use the accessors; they are more conveiient, but `getIncomingValue` and `getIncomingBlock` would also suffice, at the cost of being a bit less convenient.

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


More information about the llvm-commits mailing list