[llvm] [VPlan] Add VPPhiAccessors to provide interface for phi recipes (NFC) (PR #129388)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 28 08:24:32 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:
Is this return (in simplification?) worth the investment. Would an API of `getIncomingValue(Idx)`, `getIncomingBlock(Idx)`, and possibly `getNumIncomings()` common to all phi recipes suffice.
https://github.com/llvm/llvm-project/pull/129388
More information about the llvm-commits
mailing list