diff options
author | Max Kazantsev <max.kazantsev@azul.com> | 2018-09-04 06:34:40 +0000 |
---|---|---|
committer | Max Kazantsev <max.kazantsev@azul.com> | 2018-09-04 06:34:40 +0000 |
commit | f34115c6278eee013fee497b6d69528edb58c51c (patch) | |
tree | 0362eed6ceb56c3169900ae2ff7f8511817612ea /llvm/lib/Transforms | |
parent | f2d4372e0e660720bbe4d1d266da2cf783868666 (diff) | |
download | bcm5719-llvm-f34115c6278eee013fee497b6d69528edb58c51c.tar.gz bcm5719-llvm-f34115c6278eee013fee497b6d69528edb58c51c.zip |
[NFC] Add assert to detect LCSSA breaches early
llvm-svn: 341347
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index 372ea61c159..06836360610 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -645,6 +645,16 @@ void IndVarSimplify::rewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter) { continue; } +#ifndef NDEBUG + // If we reuse an instruction from a loop which is neither L nor one of + // its containing loops, we end up breaking LCSSA form for this loop by + // creating a new use of its instruction. + if (auto *ExitInsn = dyn_cast<Instruction>(ExitVal)) + if (auto *EVL = LI->getLoopFor(ExitInsn->getParent())) + if (EVL != L) + assert(EVL->contains(L) && "LCSSA breach detected!"); +#endif + // Collect all the candidate PHINodes to be rewritten. RewritePhiSet.emplace_back(PN, i, ExitVal, HighCost); } |