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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu May 1 14:10:35 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,
----------------
fhahn wrote:

Yep had a similar thought, but wasn't sure what a good name would be. Added as `getCFGPredecessor(Idx)` to start with. Could add an iterator version separately when other iterators are added

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


More information about the llvm-commits mailing list