[llvm-commits] CVS: reopt/lib/LightWtProfiling/TraceToFunction.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Wed Jan 14 16:10:03 PST 2004
Changes in directory reopt/lib/LightWtProfiling:
TraceToFunction.cpp updated: 1.18 -> 1.19
---
Log message:
Add GEP/store pairs using *cloned* values, not original values! And, don't
ever do it for values which are not really live-out. This bug was causing
trace functions to flunk the verifier.
Clarify some of my comments, and get rid of the "About to make a GEP"
debug printouts, which are no longer useful.
---
Diffs of the changes: (+9 -14)
Index: reopt/lib/LightWtProfiling/TraceToFunction.cpp
diff -u reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.18 reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.19
--- reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.18 Tue Jan 13 12:17:01 2004
+++ reopt/lib/LightWtProfiling/TraceToFunction.cpp Wed Jan 14 16:08:55 2004
@@ -305,8 +305,8 @@
lastSrcFound = i;
++onTraceSources;
}
- // Case 0. If it has 0 sources on the trace, that should really
- // never happen.
+ // Case 0. If the phi node has 0 sources on the trace, abort,
+ // because that should really never happen.
assert (onTraceSources != 0
&& "Phi node on trace has ALL its sources from off-trace!");
// Case 1. If it has 1 source S on the trace, replace its uses
@@ -318,8 +318,8 @@
PN->replaceAllUsesWith (PN->getIncomingValue (lastSrcFound));
goners.push_back (BI); // Delete non-used phi node later.
} else {
- // Case N. If it has >1 source on the trace, just delete
- // sources from the Phi node that are not on the trace.
+ // Case N. If the phi node has >1 source on the trace, just
+ // delete sources from the Phi node that are not on the trace.
int lastOffTraceSrcFound;
do {
lastOffTraceSrcFound = -1;
@@ -463,21 +463,16 @@
unsigned Slot = 0;
for (LiveVariableSet::iterator SI = So.begin (), SE = So.end ();
SI != SE; ++SI) {
+ if (!T.dominates (cast<Instruction> ((*SI))->getParent (), BI->getParent ())) continue;
std::vector<Value *> Index;
- Index.push_back (Constant::getNullValue (Type::LongTy)); //long 0
+ Index.push_back (Constant::getNullValue (Type::LongTy)); //long 0
Index.push_back (ConstantUInt::get (Type::UByteTy, Slot));//ubyte Slot
- DEBUG(std::cerr << "About to make a GEP: " << getFunctionArg (F, 0));
- for (std::vector<Value *>::iterator VI = Index.begin(),
- VE = Index.end (); VI != VE; ++VI) {
- DEBUG(std::cerr << ", " << **VI);
- }
- DEBUG(std::cerr << "\n");
GetElementPtrInst *GEP =
new GetElementPtrInst (getFunctionArg (F, 0), Index,
"liveOutP" + utostr (BranchNumber[BI])
+ "_" + utostr (i) + "_" + utostr (Slot));
FB->getInstList ().push_back (GEP);
- FB->getInstList ().push_back (new StoreInst (*SI, GEP));
+ FB->getInstList ().push_back (new StoreInst (O2CMap[*SI], GEP));
++Slot;
}
// Make FB contain a return instruction that returns the
@@ -543,8 +538,8 @@
I.setOperand(i, O2CMap[V]);
}
}
- // Make sure that our operand fixups did the Right Thing for
- // branches.
+ // Make sure that our operand fixups did not try to branch into a
+ // BB outside the trace function or a non-cloned BB.
DEBUG(if (BranchInst *BrI = dyn_cast<BranchInst> (&I)) {
for (unsigned i = 0; i < BrI->getNumSuccessors (); ++i) {
BasicBlock *succ = BrI->getSuccessor (i);
More information about the llvm-commits
mailing list