projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d4e46a6
)
LSR ivchain bug fix: corner case with ConstantExpr.
author
Andrew Trick
<atrick@apple.com>
Mon, 26 Mar 2012 20:28:37 +0000
(20:28 +0000)
committer
Andrew Trick
<atrick@apple.com>
Mon, 26 Mar 2012 20:28:37 +0000
(20:28 +0000)
Fixes PR11950.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153463
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Transforms/Scalar/LoopStrengthReduce.cpp
patch
|
blob
|
history
diff --git
a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index f2112446ade122563abd26eb28d909aecc73d711..7e71683dc1a4aae77285cd71b749b2479d765558 100644
(file)
--- a/
lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/
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;
}