[llvm] [VPlan] Add VPPhiAccessors to provide interface for phi recipes (NFC) (PR #129388)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 1 03:33:46 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]);
- }
----------------
ayalz wrote:
How about first wrapping `getIncomingValue` and `getIncomingBlock` within `VPPhiAccessors`, and introduce the additional zipped iterator API as a separate follow-up. That would help clarify the convenience versus investment.
https://github.com/llvm/llvm-project/pull/129388
More information about the llvm-commits
mailing list