[llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h LoopInfo.h
Chris Lattner
lattner at cs.uiuc.edu
Sat Jan 14 12:55:21 PST 2006
Changes in directory llvm/include/llvm/Analysis:
Dominators.h updated: 1.52 -> 1.53
LoopInfo.h updated: 1.51 -> 1.52
---
Log message:
Change ET-Forest to automatically recalculate its DFSnum's if too many slow
queries are made.
Patch by Daniel Berlin!
---
Diffs of the changes: (+17 -7)
Dominators.h | 20 +++++++++++++++-----
LoopInfo.h | 4 ++--
2 files changed, 17 insertions(+), 7 deletions(-)
Index: llvm/include/llvm/Analysis/Dominators.h
diff -u llvm/include/llvm/Analysis/Dominators.h:1.52 llvm/include/llvm/Analysis/Dominators.h:1.53
--- llvm/include/llvm/Analysis/Dominators.h:1.52 Sun Jan 8 02:19:58 2006
+++ llvm/include/llvm/Analysis/Dominators.h Sat Jan 14 14:55:08 2006
@@ -397,16 +397,17 @@
///
struct ETForestBase : public DominatorBase {
ETForestBase(bool isPostDom) : DominatorBase(isPostDom), Nodes(),
- DFSInfoValid(false) {}
+ DFSInfoValid(false), SlowQueries(0) {}
virtual void releaseMemory() { reset(); }
typedef std::map<BasicBlock*, ETNode*> ETMapType;
-
+ void updateDFSNumbers();
+
/// dominates - Return true if A dominates B.
///
- inline bool dominates(BasicBlock *A, BasicBlock *B) const {
+ inline bool dominates(BasicBlock *A, BasicBlock *B) {
if (A == B)
return true;
@@ -415,13 +416,21 @@
if (DFSInfoValid)
return NodeB->DominatedBy(NodeA);
- else
+ else {
+ // If we end up with too many slow queries, just update the
+ // DFS numbers on the theory that we are going to keep querying.
+ SlowQueries++;
+ if (SlowQueries > 32) {
+ updateDFSNumbers();
+ return NodeB->DominatedBy(NodeA);
+ }
return NodeB->DominatedBySlow(NodeA);
+ }
}
/// properlyDominates - Return true if A dominates B and A != B.
///
- bool properlyDominates(BasicBlock *A, BasicBlock *B) const {
+ bool properlyDominates(BasicBlock *A, BasicBlock *B) {
return dominates(A, B) && A != B;
}
@@ -474,6 +483,7 @@
void reset();
ETMapType Nodes;
bool DFSInfoValid;
+ unsigned int SlowQueries;
};
Index: llvm/include/llvm/Analysis/LoopInfo.h
diff -u llvm/include/llvm/Analysis/LoopInfo.h:1.51 llvm/include/llvm/Analysis/LoopInfo.h:1.52
--- llvm/include/llvm/Analysis/LoopInfo.h:1.51 Tue Jan 10 23:08:57 2006
+++ llvm/include/llvm/Analysis/LoopInfo.h Sat Jan 14 14:55:08 2006
@@ -297,8 +297,8 @@
static void stub(); // Noop
private:
- void Calculate(const ETForest &EF);
- Loop *ConsiderForLoop(BasicBlock *BB, const ETForest &EF);
+ void Calculate(ETForest &EF);
+ Loop *ConsiderForLoop(BasicBlock *BB, ETForest &EF);
void MoveSiblingLoopInto(Loop *NewChild, Loop *NewParent);
void InsertLoopInto(Loop *L, Loop *Parent);
};
More information about the llvm-commits
mailing list