diff options
author | Dan Gohman <gohman@apple.com> | 2010-02-13 00:19:39 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-02-13 00:19:39 +0000 |
commit | fe873e7c10bd062ccd8a9505ed0220a5df07acd0 (patch) | |
tree | 893c8c44215984d0f381fee2c5be96e28460ad03 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 224340cabee2984d96b37a14f97f74b5fa3c6cf0 (diff) | |
download | bcm5719-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
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
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) |