aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-12-04 08:13:06 +0000
committerChris Lattner <sabre@nondot.org>2001-12-04 08:13:06 +0000
commit3bf915f2a296472a6bead0502c88bf74e90ec19b (patch)
treeff0c49d1b4df3b3068f1f8218beb5f5f3c163b11
parent4b770a3145378bd5436b35dc52cce4e2d2868ea0 (diff)
downloadexternal_llvm-3bf915f2a296472a6bead0502c88bf74e90ec19b.zip
external_llvm-3bf915f2a296472a6bead0502c88bf74e90ec19b.tar.gz
external_llvm-3bf915f2a296472a6bead0502c88bf74e90ec19b.tar.bz2
Fix bugs, don't do external methods which causes segv.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1414 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index a6e0bd1..3b64756 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -127,7 +127,8 @@ static bool TransformLoop(cfg::LoopInfo *Loops, cfg::Loop *Loop) {
#ifdef DEBUG
cerr << IndVars[i];
#endif
- if (IV != Cannonical) { // Don't modify the cannonical indvar
+ // Don't modify the cannonical indvar or unrecognized indvars...
+ if (IV != Cannonical && IV->InductionType != InductionVariable::Unknown) {
Instruction *Val = IterCount;
if (!isa<ConstantInt>(IV->Step) || // If the step != 1
!cast<ConstantInt>(IV->Step)->equalsInt(1)) {
@@ -183,6 +184,8 @@ static bool TransformLoop(cfg::LoopInfo *Loops, cfg::Loop *Loop) {
}
bool InductionVariableSimplify::doit(Method *M) {
+ if (M->isExternal()) return false;
+
// Figure out the loop structure of the method...
cfg::LoopInfo Loops(M);