[llvm] cf06047 - [LV] Remove AddedAnyChecks, check directly instead (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 6 12:20:19 PDT 2025
Author: Florian Hahn
Date: 2025-07-06T20:19:46+01:00
New Revision: cf06047231586c9392915367161f8b2026b9ab0b
URL: https://github.com/llvm/llvm-project/commit/cf06047231586c9392915367161f8b2026b9ab0b
DIFF: https://github.com/llvm/llvm-project/commit/cf06047231586c9392915367161f8b2026b9ab0b.diff
LOG: [LV] Remove AddedAnyChecks, check directly instead (NFC).
As suggested in https://github.com/llvm/llvm-project/pull/143879, remove
AddedAnyChecks member and directly check if there are any relevant
runtime check blocks.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 907839711a39c..1209460237d93 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1778,9 +1778,6 @@ class GeneratedRTChecks {
/// If it is nullptr no memory runtime checks have been generated.
Value *MemRuntimeCheckCond = nullptr;
- /// True if any checks have been added.
- bool AddedAnyChecks = false;
-
DominatorTree *DT;
LoopInfo *LI;
TargetTransformInfo *TTI;
@@ -2044,7 +2041,6 @@ class GeneratedRTChecks {
if (AddBranchWeights)
setBranchWeights(BI, SCEVCheckBypassWeights, /*IsExpected=*/false);
ReplaceInstWithInst(SCEVCheckBlock->getTerminator(), &BI);
- AddedAnyChecks = true;
return SCEVCheckBlock;
}
@@ -2072,12 +2068,15 @@ class GeneratedRTChecks {
MemCheckBlock->getTerminator()->setDebugLoc(
Pred->getTerminator()->getDebugLoc());
- AddedAnyChecks = true;
return MemCheckBlock;
}
/// Return true if any runtime checks have been added
- bool hasChecks() const { return AddedAnyChecks; }
+ bool hasChecks() const {
+ using namespace llvm::PatternMatch;
+ return (SCEVCheckCond && !match(SCEVCheckCond, m_ZeroInt())) ||
+ MemRuntimeCheckCond;
+ }
};
} // namespace
More information about the llvm-commits
mailing list