diff options
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
| -rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 77f2467d72d..e5134f2eeda 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -112,6 +112,7 @@ #include "llvm/IR/Use.h" #include "llvm/IR/User.h" #include "llvm/IR/Value.h" +#include "llvm/IR/Verifier.h" #include "llvm/Pass.h" #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" @@ -162,6 +163,11 @@ static cl::opt<bool> cl::desc("Verify no dangling value in ScalarEvolution's " "ExprValueMap (slow)")); +static cl::opt<bool> VerifyIR( + "scev-verify-ir", cl::Hidden, + cl::desc("Verify IR correctness when making sensitive SCEV queries (slow)"), + cl::init(false)); + static cl::opt<unsigned> MulOpsInlineThreshold( "scev-mulops-inline-threshold", cl::Hidden, cl::desc("Threshold for inlining multiplication operands into a SCEV"), @@ -9370,6 +9376,11 @@ ScalarEvolution::isLoopBackedgeGuardedByCond(const Loop *L, // (interprocedural conditions notwithstanding). if (!L) return true; + if (VerifyIR) + assert(!verifyFunction(*L->getHeader()->getParent(), &dbgs()) && + "This cannot be done on broken IR!"); + + if (isKnownViaNonRecursiveReasoning(Pred, LHS, RHS)) return true; @@ -9475,6 +9486,10 @@ ScalarEvolution::isLoopEntryGuardedByCond(const Loop *L, // (interprocedural conditions notwithstanding). if (!L) return false; + if (VerifyIR) + assert(!verifyFunction(*L->getHeader()->getParent(), &dbgs()) && + "This cannot be done on broken IR!"); + // Both LHS and RHS must be available at loop entry. assert(isAvailableAtLoopEntry(LHS, L) && "LHS is not available at Loop Entry"); |

