summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-03-26 20:28:37 +0000
committerAndrew Trick <atrick@apple.com>2012-03-26 20:28:37 +0000
commit14779cc49e88e07b334f118c10a861c96fc01350 (patch)
tree24e429a0668b26aa69e8b9adfb0e73c7874f3f20 /llvm/lib
parent356a896394e05aa9ba6f7645d2450ca39a5c99fa (diff)
downloadbcm5719-llvm-14779cc49e88e07b334f118c10a861c96fc01350.tar.gz
bcm5719-llvm-14779cc49e88e07b334f118c10a861c96fc01350.zip
LSR ivchain bug fix: corner case with ConstantExpr.
Fixes PR11950. llvm-svn: 153463
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index f2112446ade..7e71683dc1a 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -704,8 +704,9 @@ static bool isHighCostExpansion(const SCEV *S,
Value *UVal = U->getValue();
for (Value::use_iterator UI = UVal->use_begin(), UE = UVal->use_end();
UI != UE; ++UI) {
- Instruction *User = cast<Instruction>(*UI);
- if (User->getOpcode() == Instruction::Mul
+ // If U is a constant, it may be used by a ConstantExpr.
+ Instruction *User = dyn_cast<Instruction>(*UI);
+ if (User && User->getOpcode() == Instruction::Mul
&& SE.isSCEVable(User->getType())) {
return SE.getSCEV(User) == Mul;
}
OpenPOWER on IntegriCloud