aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-04 19:26:19 +0000
committerChris Lattner <sabre@nondot.org>2005-08-04 19:26:19 +0000
commit7a2ca56ef3bdda6874bcd4df2910fb5a33999f85 (patch)
tree6eb1e70ba2ffc2b87fb8ee5dda5d0fac9f21acba /lib/Transforms/Scalar/LoopStrengthReduce.cpp
parent7db543f887c83aad2a95814a16d363a2313fc2a8 (diff)
Fix a case that caused this to crash on 178.galgel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22653 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 7b743e230e..dfe72c11fc 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -415,6 +415,12 @@ static SCEVHandle GetImmediateValues(SCEVHandle Val, bool isAddress, Loop *L) {
return GetImmediateValues(SARE->getStart(), isAddress, L);
}
+ if (!Val->isLoopInvariant(L)) {
+ // If this is a loop-variant expression, it must stay in the immediate
+ // field of the expression.
+ return Val;
+ }
+
return SCEVUnknown::getIntegerSCEV(0, Val->getType());
}