[llvm] 06ebed3 - [SCEVNormalization] Short circuit case with no loops (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 20 01:48:23 PDT 2023
Author: Nikita Popov
Date: 2023-06-20T10:48:16+02:00
New Revision: 06ebed3e55759ab503c9bbcae5e47fcce9f26928
URL: https://github.com/llvm/llvm-project/commit/06ebed3e55759ab503c9bbcae5e47fcce9f26928
DIFF: https://github.com/llvm/llvm-project/commit/06ebed3e55759ab503c9bbcae5e47fcce9f26928.diff
LOG: [SCEVNormalization] Short circuit case with no loops (NFC)
If there are no post-inc loops, normalization is a no-op. Don't
bother rewriting the SCEV in that case.
Added:
Modified:
llvm/lib/Analysis/ScalarEvolutionNormalization.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolutionNormalization.cpp b/llvm/lib/Analysis/ScalarEvolutionNormalization.cpp
index 22dff5efec5c8..bc0fbffee61b0 100644
--- a/llvm/lib/Analysis/ScalarEvolutionNormalization.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionNormalization.cpp
@@ -97,6 +97,8 @@ NormalizeDenormalizeRewriter::visitAddRecExpr(const SCEVAddRecExpr *AR) {
const SCEV *llvm::normalizeForPostIncUse(const SCEV *S,
const PostIncLoopSet &Loops,
ScalarEvolution &SE) {
+ if (Loops.empty())
+ return S;
auto Pred = [&](const SCEVAddRecExpr *AR) {
return Loops.count(AR->getLoop());
};
@@ -111,6 +113,8 @@ const SCEV *llvm::normalizeForPostIncUseIf(const SCEV *S, NormalizePredTy Pred,
const SCEV *llvm::denormalizeForPostIncUse(const SCEV *S,
const PostIncLoopSet &Loops,
ScalarEvolution &SE) {
+ if (Loops.empty())
+ return S;
auto Pred = [&](const SCEVAddRecExpr *AR) {
return Loops.count(AR->getLoop());
};
More information about the llvm-commits
mailing list