[llvm] [VPlan] Make canonical IV part of the region (PR #156262)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 15 07:00:22 PST 2026
================
@@ -4257,24 +4221,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();
- /// Return the type of the canonical IV for loop regions.
- Type *getCanonicalIVType() { return getCanonicalIV()->getScalarType(); }
- const Type *getCanonicalIVType() const {
- return getCanonicalIV()->getScalarType();
- }
+ /// Return the canonical induction variable of the region, null for
+ /// replicating regions.
+ VPValue *getCanonicalIV() { return CanIVInfo->getVPValue(); }
+ const VPValue *getCanonicalIV() const { return CanIVInfo->getVPValue(); }
+
+ Type *getCanonicalIVType() const { return CanIVInfo->getType(); }
+
+ const VPCanonicalIVInfo &getCanonicalIVInfo() const { return *CanIVInfo; }
+
+ DebugLoc getCanonicalIVDebugLoc() const { return CanIVInfo->getDebugLoc(); }
+ bool hasCanonicalIVNUW() const { return CanIVInfo->hasNUW(); }
+ void clearCanonicalIVNUW() { CanIVInfo->clearNUW(); }
----------------
fhahn wrote:
done thanks
https://github.com/llvm/llvm-project/pull/156262
More information about the llvm-commits
mailing list