summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-02-13 00:19:39 +0000
committerDan Gohman <gohman@apple.com>2010-02-13 00:19:39 +0000
commitfe873e7c10bd062ccd8a9505ed0220a5df07acd0 (patch)
tree893c8c44215984d0f381fee2c5be96e28460ad03
parent224340cabee2984d96b37a14f97f74b5fa3c6cf0 (diff)
downloadbcm5719-llvm-fe873e7c10bd062ccd8a9505ed0220a5df07acd0.tar.gz
bcm5719-llvm-fe873e7c10bd062ccd8a9505ed0220a5df07acd0.zip
Override dominates and properlyDominates for SCEVAddRecExpr, as a
SCEVAddRecExpr doesn't necessarily dominate blocks merely dominated by all of its operands. This fixes an abort compiling 403.gcc. llvm-svn: 96056
-rw-r--r--llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h4
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp15
2 files changed, 19 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
index 3645a5b12fd..0ab3b3f4a5e 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -417,6 +417,10 @@ namespace llvm {
virtual bool isLoopInvariant(const Loop *QueryLoop) const;
+ bool dominates(BasicBlock *BB, DominatorTree *DT) const;
+
+ bool properlyDominates(BasicBlock *BB, DominatorTree *DT) const;
+
/// isAffine - Return true if this is an affine AddRec (i.e., it represents
/// an expressions A+B*x where A and B are loop invariant values.
bool isAffine() const {
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 82be9cd5c4e..12be58e8b3a 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -312,6 +312,21 @@ bool SCEVAddRecExpr::isLoopInvariant(const Loop *QueryLoop) const {
return true;
}
+bool
+SCEVAddRecExpr::dominates(BasicBlock *BB, DominatorTree *DT) const {
+ return DT->dominates(L->getHeader(), BB) &&
+ SCEVNAryExpr::dominates(BB, DT);
+}
+
+bool
+SCEVAddRecExpr::properlyDominates(BasicBlock *BB, DominatorTree *DT) const {
+ // This uses a "dominates" query instead of "properly dominates" query because
+ // the instruction which produces the addrec's value is a PHI, and a PHI
+ // effectively properly dominates its entire containing block.
+ return DT->dominates(L->getHeader(), BB) &&
+ SCEVNAryExpr::properlyDominates(BB, DT);
+}
+
void SCEVAddRecExpr::print(raw_ostream &OS) const {
OS << "{" << *Operands[0];
for (unsigned i = 1, e = Operands.size(); i != e; ++i)
OpenPOWER on IntegriCloud