From 0f7c0fa2a7dfc7f04937c856c379375a551e342c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 4 Aug 2005 19:26:19 +0000 Subject: Fix a case that caused this to crash on 178.galgel llvm-svn: 22653 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/Transforms/Scalar') diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 7b743e230e8..dfe72c11fcd 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/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()); } -- cgit v1.2.3