aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index ddce751104..9a9b0c2aec 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -483,8 +483,7 @@ static SCEVHandle GetImmediateValues(SCEVHandle Val, bool isAddress) {
if (isTargetConstant(Val))
return Val;
- SCEVAddExpr *SAE = dyn_cast<SCEVAddExpr>(Val);
- if (SAE) {
+ if (SCEVAddExpr *SAE = dyn_cast<SCEVAddExpr>(Val)) {
unsigned i = 0;
for (; i != SAE->getNumOperands(); ++i)
if (isTargetConstant(SAE->getOperand(i))) {
@@ -497,6 +496,9 @@ static SCEVHandle GetImmediateValues(SCEVHandle Val, bool isAddress) {
ImmVal = SCEVAddExpr::get(ImmVal, SAE->getOperand(i));
return ImmVal;
}
+ } else if (SCEVAddRecExpr *SARE = dyn_cast<SCEVAddRecExpr>(Val)) {
+ // Try to pull immediates out of the start value of nested addrec's.
+ return GetImmediateValues(SARE->getStart(), isAddress);
}
return SCEVUnknown::getIntegerSCEV(0, Val->getType());