[llvm] 7d418da - [NFCI][LoopDeletion] Do not call complex analysis for known non-zero BTC
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Thu May 27 01:29:56 PDT 2021
Author: Max Kazantsev
Date: 2021-05-27T15:29:37+07:00
New Revision: 7d418dadf6b1e6fd9bcccf7c5b5e1db74992ee70
URL: https://github.com/llvm/llvm-project/commit/7d418dadf6b1e6fd9bcccf7c5b5e1db74992ee70
DIFF: https://github.com/llvm/llvm-project/commit/7d418dadf6b1e6fd9bcccf7c5b5e1db74992ee70.diff
LOG: [NFCI][LoopDeletion] Do not call complex analysis for known non-zero BTC
Added:
Modified:
llvm/lib/Transforms/Scalar/LoopDeletion.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
index 8326a1589bcf..058f66640c79 100644
--- a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
@@ -343,6 +343,8 @@ breakBackedgeIfNotTaken(Loop *L, DominatorTree &DT, ScalarEvolution &SE,
return LoopDeletionResult::Unmodified;
auto *BTC = SE.getBackedgeTakenCount(L);
+ if (!isa<SCEVCouldNotCompute>(BTC) && SE.isKnownNonZero(BTC))
+ return LoopDeletionResult::Unmodified;
if (!BTC->isZero() && !canProveExitOnFirstIteration(L, DT, SE, LI))
return LoopDeletionResult::Unmodified;
More information about the llvm-commits
mailing list