[llvm-commits] [llvm] r139169 - /llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp

Andrew Trick atrick at apple.com
Tue Sep 6 13:20:38 PDT 2011


Author: atrick
Date: Tue Sep  6 15:20:38 2011
New Revision: 139169

URL: http://llvm.org/viewvc/llvm-project?rev=139169&view=rev
Log:
Add -verify-indvars for imperfect SCEV trip count verification after indvars.

Modified:
    llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=139169&r1=139168&r2=139169&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Tue Sep  6 15:20:38 2011
@@ -76,6 +76,13 @@
   cl::opt<bool> DisableIVRewrite(
     "disable-iv-rewrite", cl::Hidden,
     cl::desc("Disable canonical induction variable rewriting"));
+
+  // Trip count verification can be enabled by default under NDEBUG if we
+  // implement a strong expression equivalence checker in SCEV. Until then, we
+  // use the verify-indvars flag, which may assert in some cases.
+  cl::opt<bool> VerifyIndvars(
+    "verify-indvars", cl::Hidden,
+    cl::desc("Verify the ScalarEvolution result after running indvars"));
 }
 
 // Temporary flag for use with -disable-iv-rewrite to force a canonical IV for
@@ -1968,7 +1975,8 @@
   // Verify that LFTR, and any other change have not interfered with SCEV's
   // ability to compute trip count.
 #ifndef NDEBUG
-  if (DisableIVRewrite && !isa<SCEVCouldNotCompute>(BackedgeTakenCount)) {
+  if (DisableIVRewrite && VerifyIndvars &&
+      !isa<SCEVCouldNotCompute>(BackedgeTakenCount)) {
     SE->forgetLoop(L);
     const SCEV *NewBECount = SE->getBackedgeTakenCount(L);
     if (SE->getTypeSizeInBits(BackedgeTakenCount->getType()) <





More information about the llvm-commits mailing list