[llvm-commits] CVS: reopt/lib/TraceToFunction/TraceToFunction.cpp
Brian Gaeke
gaeke at persephone.cs.uiuc.edu
Mon Jun 14 16:36:01 PDT 2004
Changes in directory reopt/lib/TraceToFunction:
TraceToFunction.cpp updated: 1.65 -> 1.66
---
Log message:
Fix the FIXME in DefinedInTraceBeforeUse() by letting it start to
look for defs starting from any point in the trace, not just the
beginning. Also fix a typo in getTraceLiveOutSet().
---
Diffs of the changes: (+6 -8)
Index: reopt/lib/TraceToFunction/TraceToFunction.cpp
diff -u reopt/lib/TraceToFunction/TraceToFunction.cpp:1.65 reopt/lib/TraceToFunction/TraceToFunction.cpp:1.66
--- reopt/lib/TraceToFunction/TraceToFunction.cpp:1.65 Mon Jun 14 15:54:45 2004
+++ reopt/lib/TraceToFunction/TraceToFunction.cpp Mon Jun 14 16:32:05 2004
@@ -103,20 +103,19 @@
}
static bool DefinedInTraceBeforeUse (Value *V, Trace &T, Trace::iterator Start) {
- assert (Start == T.begin ()
- && "FIXME: Can only start at beginning of trace for now");
Instruction *Inst = dyn_cast<Instruction> (V);
if (!Inst)
return false;
BasicBlock *Block = Inst->getParent ();
- if (!T.contains (Block)) // Is V defined in trace?
+ if (std::find (Start, T.end (), Block) == T.end ()) // Is V defined in trace?
return false;
for (Value::use_iterator ui = V->use_begin (), ue = V->use_end ();
ui != ue; ++ui) {
Instruction *UInst = dyn_cast<Instruction> (*ui);
if (!UInst) // Non-Instruction Users scare me, mommy
return false;
- if (isa<PHINode> (UInst) && T.contains (UInst->getParent ()))
+ if (isa<PHINode> (UInst)
+ && std::find (Start, T.end (), UInst->getParent ()) != T.end ())
continue; // If a Phi node in the trace uses a value that's defined in the
// trace, the def. must have originally dominated the Phi.
BasicBlock *UBlock = UInst->getParent ();
@@ -132,13 +131,12 @@
break;
}
} else {
- if (!T.contains (UBlock))
- return false;
+ if (std::find (Start, T.end (), UBlock) == T.end ()) return false;
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))
+ if (!dominates (T, Block, UBlock, *Start))
return false;
}
}
@@ -191,7 +189,7 @@
// Only consider those which produce values (not void or labels).
if (!(Inst->getType () == Type::VoidTy
|| Inst->getType () == Type::LabelTy))
- if (!DefinedInTraceBeforeUse (Inst, T, StartingFrom))
+ if (!DefinedInTraceBeforeUse (Inst, T, T.begin ()))
S.insert (Inst);
}
More information about the llvm-commits
mailing list