[llvm-commits] CVS: reopt/lib/TraceToFunction/TraceToFunction.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Wed Aug 4 23:44:14 PDT 2004
Changes in directory reopt/lib/TraceToFunction:
TraceToFunction.cpp updated: 1.83 -> 1.84
---
Log message:
This old dominates() function can go, now that we have a DominatorSet.
---
Diffs of the changes: (+3 -31)
Index: reopt/lib/TraceToFunction/TraceToFunction.cpp
diff -u reopt/lib/TraceToFunction/TraceToFunction.cpp:1.83 reopt/lib/TraceToFunction/TraceToFunction.cpp:1.84
--- reopt/lib/TraceToFunction/TraceToFunction.cpp:1.83 Wed Aug 4 00:28:02 2004
+++ reopt/lib/TraceToFunction/TraceToFunction.cpp Thu Aug 5 01:44:02 2004
@@ -114,28 +114,6 @@
virtual bool runOnFunction (Function &F);
};
-static bool dominates (Trace &T, const BasicBlock *B1,
- const BasicBlock *B2, const BasicBlock *start = 0) {
- if (!start)
- start = T.getEntryBasicBlock ();
- if (start == B1) {
- return true; // Seen B1 on this path, if we see B2 later it's OK.
- } else if (start == B2) {
- return false; // Seen B2, w/o seeing B1 earlier on this path. Not OK.
- } else {
- // If any successors are on the trace, AND not the entry BB, check them too.
- // (Stop at entry BB because we don't want to loop if the CFG loops.)
- for (succ_const_iterator i = succ_begin (start), e = succ_end (start);
- i != e; ++i) {
- const BasicBlock *succ = *i;
- if (T.contains (succ) && (T.getEntryBasicBlock () != succ)
- && (!dominates (T, B1, B2, succ)))
- return false;
- }
- return true; // Dominates on all successors ==> dominates here too
- }
-}
-
static bool DefinedInTraceBeforeUse (Value *V, Trace &T, Trace::iterator Start, bool ignoreOffTraceUsers) {
Instruction *Inst = dyn_cast<Instruction> (V);
if (!Inst) {
@@ -186,14 +164,6 @@
} else {
DEBUG (std::cerr << "TLV: " << V->getName () << "'s User " << UInst->getName () << " is off-trace, but we don't care\n");
}
- } else {
- // If UBlock appears BEFORE Block on some path from the first
- // basic block of the trace to an exit BB of the trace, return
- // false.
- if (!dominates (T, Block, UBlock, *Start)) {
- DEBUG (std::cerr << "TLV: " << V->getName () << "'s User " << UInst->getName () << " not dominated by Def!\n");
- return false;
- }
}
}
}
@@ -284,6 +254,8 @@
// Find the position of the block in the trace.
Trace::iterator StartingFrom = std::find (T.begin (), T.end (), *i);
assert (StartingFrom != T.end () && "AlternateEntryPoint not on trace?!");
+ DEBUG (std::cerr << "TLV: adding trace live-ins starting from alt. entry "
+ << (*i)->getName () << " as live-out\n");
addTraceLiveInsToSet (S, LVV, T, StartingFrom);
}
}
@@ -799,7 +771,7 @@
Value *V = *SI;
bool storeIt = true;
if (Instruction *Inst = dyn_cast<Instruction> (V))
- storeIt = dominates (T, Inst->getParent (), BI->getParent ());
+ storeIt = DS->dominates (Inst, BI);
else // it's an Argument, so it must dominate the store.
assert (isa<Argument> (V) && "not instruction, not argument??");
if (storeIt)
More information about the llvm-commits
mailing list