summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJingyue Wu <jingyue@google.com>2015-06-28 17:45:05 +0000
committerJingyue Wu <jingyue@google.com>2015-06-28 17:45:05 +0000
commit3abde7bea5a0c26bd5e7aecff9f1bad60ea2892e (patch)
treeab977c94e001182e5ca878ba1fd2531ef2c667ad /llvm/lib
parent50a6f9157bb7f8783ca32f6956242218c7b146d9 (diff)
downloadbcm5719-llvm-3abde7bea5a0c26bd5e7aecff9f1bad60ea2892e.tar.gz
bcm5719-llvm-3abde7bea5a0c26bd5e7aecff9f1bad60ea2892e.zip
[SLSR] S's basis must have the same type as S
llvm-svn: 240910
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
index f32769c2411..6d9d417ef94 100644
--- a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
@@ -224,11 +224,13 @@ FunctionPass *llvm::createStraightLineStrengthReducePass() {
bool StraightLineStrengthReduce::isBasisFor(const Candidate &Basis,
const Candidate &C) {
return (Basis.Ins != C.Ins && // skip the same instruction
+ // They must have the same type too. Basis.Base == C.Base doesn't
+ // guarantee their types are the same (PR23975).
+ Basis.Ins->getType() == C.Ins->getType() &&
// Basis must dominate C in order to rewrite C with respect to Basis.
DT->dominates(Basis.Ins->getParent(), C.Ins->getParent()) &&
// They share the same base, stride, and candidate kind.
- Basis.Base == C.Base &&
- Basis.Stride == C.Stride &&
+ Basis.Base == C.Base && Basis.Stride == C.Stride &&
Basis.CandidateKind == C.CandidateKind);
}
OpenPOWER on IntegriCloud