diff options
author | Dan Gohman <gohman@apple.com> | 2010-06-18 01:35:11 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-06-18 01:35:11 +0000 |
commit | a52838285b6dce66821f0b272cb3479af8c3edb2 (patch) | |
tree | e90d821d2d12ed9fdcf5d5d51e53d7379c23b432 /lib/Transforms/Scalar | |
parent | e54081088e82813b5ab36d3a797172f3455c68ba (diff) | |
download | external_llvm-a52838285b6dce66821f0b272cb3479af8c3edb2.zip external_llvm-a52838285b6dce66821f0b272cb3479af8c3edb2.tar.gz external_llvm-a52838285b6dce66821f0b272cb3479af8c3edb2.tar.bz2 |
Disable indvars on loops when LoopSimplify form is not available.
This fixes PR7333.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106267 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/IndVarSimplify.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 36bea67..84e393f 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -467,6 +467,17 @@ void IndVarSimplify::EliminateIVRemainders() { } bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) { + // If LoopSimplify form is not available, stay out of trouble. Some notes: + // - LSR currently only supports LoopSimplify-form loops. Indvars' + // canonicalization can be a pessimization without LSR to "clean up" + // afterwards. + // - We depend on having a preheader; in particular, + // Loop::getCanonicalInductionVariable only supports loops with preheaders, + // and we're in trouble if we can't find the induction variable even when + // we've manually inserted one. + if (!L->isLoopSimplifyForm()) + return false; + IU = &getAnalysis<IVUsers>(); LI = &getAnalysis<LoopInfo>(); SE = &getAnalysis<ScalarEvolution>(); |