[llvm] [VPlan] Make canonical IV part of the region (PR #156262)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 4 06:20:38 PST 2025


================
@@ -4097,24 +4064,23 @@ class LLVM_ABI_FOR_TEST VPRegionBlock : public VPBlockBase {
   /// its entry, and its exiting block to its successor.
   void dissolveToCFGLoop();
 
-  /// Returns the canonical induction recipe of the region.
-  VPCanonicalIVPHIRecipe *getCanonicalIV() {
-    VPBasicBlock *EntryVPBB = getEntryBasicBlock();
-    if (EntryVPBB->empty()) {
-      // VPlan native path. TODO: Unify both code paths.
-      EntryVPBB = cast<VPBasicBlock>(EntryVPBB->getSingleSuccessor());
-    }
-    return cast<VPCanonicalIVPHIRecipe>(&*EntryVPBB->begin());
-  }
-  const VPCanonicalIVPHIRecipe *getCanonicalIV() const {
-    return const_cast<VPRegionBlock *>(this)->getCanonicalIV();
-  }
+  /// Get the canonical IV increment instruction. If the exiting terminator
+  /// is a BranchOnCount with an IV increment, return it. Otherwise, create
+  /// a new IV increment and return it.
+  VPInstruction *getCanonicalIVIncrement();
----------------
ayalz wrote:

getOrCreate?

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


More information about the llvm-commits mailing list