[PATCH] D46178: [SCEV] Reduce the number of invocation to non trivial getExact function

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 27 01:54:37 PDT 2018


skatkov updated this revision to Diff 144297.

https://reviews.llvm.org/D46178

Files:
  lib/Analysis/ScalarEvolution.cpp


Index: lib/Analysis/ScalarEvolution.cpp
===================================================================
--- lib/Analysis/ScalarEvolution.cpp
+++ lib/Analysis/ScalarEvolution.cpp
@@ -6502,8 +6502,10 @@
   // 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;
@@ -6513,6 +6515,7 @@
     // 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46178.144297.patch
Type: text/x-patch
Size: 1094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180427/e66d8eac/attachment.bin>


More information about the llvm-commits mailing list