mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[SCEV] Reduce the number of invocation to non trivial getExact function
The invocation of getExact in ScalarEvolution::getBackedgeTakenInfo is used only for getting statistic and for assert. Even if statistics is disabled, the code related to it will be eliminated the invocation to getExact itself will not be eliminated because it may have side-effects like creation of new SCEVs. So do invocation only when we collect statistics or executes asserts. Reviewers: mkazantsev, sanjoy, javed.absar Reviewed By: javed.absar Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46178 llvm-svn: 331099
This commit is contained in:
parent
ee6b7b1495
commit
f0f5f1370c
@ -6512,8 +6512,10 @@ ScalarEvolution::getBackedgeTakenInfo(const Loop *L) {
|
||||
// must be cleared in this scope.
|
||||
BackedgeTakenInfo Result = computeBackedgeTakenCount(L);
|
||||
|
||||
if (Result.getExact(L, this) != getCouldNotCompute()) {
|
||||
assert(isLoopInvariant(Result.getExact(L, this), L) &&
|
||||
#if LLVM_ENABLE_STATS || !defined(NDEBUG)
|
||||
const SCEV *BEExact = Result.getExact(L, this);
|
||||
if (BEExact != getCouldNotCompute()) {
|
||||
assert(isLoopInvariant(BEExact, L) &&
|
||||
isLoopInvariant(Result.getMax(this), L) &&
|
||||
"Computed backedge-taken count isn't loop invariant for loop!");
|
||||
++NumTripCountsComputed;
|
||||
@ -6523,6 +6525,7 @@ ScalarEvolution::getBackedgeTakenInfo(const Loop *L) {
|
||||
// Only count loops that have phi nodes as not being computable.
|
||||
++NumTripCountsNotComputed;
|
||||
}
|
||||
#endif // LLVM_ENABLE_STATS || !defined(NDEBUG)
|
||||
|
||||
// Now that we know more about the trip count for this loop, forget any
|
||||
// existing SCEV values for PHI nodes in this loop since they are only
|
||||
|
Loading…
Reference in New Issue
Block a user