[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
================
@@ -1205,6 +1205,32 @@ void VPIRPhi::print(raw_ostream &O, const Twine &Indent,
}
#endif
+/// Returns the incoming block at index \p Idx for \p R. This handles both
+/// recipes placed in entry blocks of loop regions (incoming blocks are the
+/// region's predecessor and the region's exit) and other locations (incoming
+/// blocks are the direct predecessors).
+static const VPBasicBlock *getIncomingBlockForRecipe(const VPRecipeBase *R,
----------------
ayalz wrote:
Should this be `getCFGPredecessors(VPBasicBlock)` or `VPBasicBlock:: getCFGPredecessors()`, as iterators and/or single element by index? Complementing `getHierarchicalPredecessors()` and `getPredecessors()`.
OTOH, if used only by `VPPhiAccessors::getIncomingBlock(Idx)`, better inline it there. But by templating `VPPhiAccessors`, this would need to be replicated per instance, as in `VPPhiAccessors<VPWidenPHIRecipe>::getIncomingBlock(Idx)`?
This provides the CFG predecessor basic-blocks of a given block (rather than recipe), which could be in CFG mode (in which case they are held explicitly, can cast them from block to basic-block) or HCFG mode (in which case region header blocks need to collect their region's predecessor('s exiting) basic-block and exiting basic-block.
https://github.com/llvm/llvm-project/pull/129388
More information about the llvm-commits
mailing list