Remove a poor scheduling heuristic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42443 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2007-09-28 19:37:35 +00:00
parent 74d2fd8dd8
commit ddde335cb7

View File

@ -1071,26 +1071,6 @@ static unsigned closestSucc(const SUnit *SU) {
return MaxCycle; return MaxCycle;
} }
/// calcMaxScratches - Returns an cost estimate of the worse case requirement
/// for scratch registers. Live-in operands and live-out results don't count
/// since they are "fixed".
static unsigned calcMaxScratches(const SUnit *SU) {
unsigned Scratches = 0;
for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
I != E; ++I) {
if (I->isCtrl) continue; // ignore chain preds
if (!I->Dep->Node || I->Dep->Node->getOpcode() != ISD::CopyFromReg)
Scratches++;
}
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I) {
if (I->isCtrl) continue; // ignore chain succs
if (!I->Dep->Node || I->Dep->Node->getOpcode() != ISD::CopyToReg)
Scratches += 10;
}
return Scratches;
}
// Bottom up // Bottom up
bool bu_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const { bool bu_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const {
// There used to be a special tie breaker here that looked for // There used to be a special tie breaker here that looked for
@ -1133,23 +1113,14 @@ bool bu_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const {
if (LDist < RDist) if (LDist < RDist)
return true; return true;
else if (LDist == RDist) { else if (LDist == RDist) {
// Intuitively, it's good to push down instructions whose results are if (left->Height > right->Height)
// liveout so their long live ranges won't conflict with other values
// which are needed inside the BB. Further prioritize liveout instructions
// by the number of operands which are calculated within the BB.
unsigned LScratch = calcMaxScratches(left);
unsigned RScratch = calcMaxScratches(right);
if (LScratch > RScratch)
return true; return true;
else if (LScratch == RScratch) else if (left->Height == right->Height)
if (left->Height > right->Height) if (left->Depth < right->Depth)
return true; return true;
else if (left->Height == right->Height) else if (left->Depth == right->Depth)
if (left->Depth < right->Depth) if (left->CycleBound > right->CycleBound)
return true; return true;
else if (left->Depth == right->Depth)
if (left->CycleBound > right->CycleBound)
return true;
} }
} }
return false; return false;