aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-06-18 01:35:11 +0000
committerDan Gohman <gohman@apple.com>2010-06-18 01:35:11 +0000
commita52838285b6dce66821f0b272cb3479af8c3edb2 (patch)
treee90d821d2d12ed9fdcf5d5d51e53d7379c23b432 /lib/Transforms/Scalar
parente54081088e82813b5ab36d3a797172f3455c68ba (diff)
downloadexternal_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.cpp11
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>();