[llvm-commits] [llvm] r60733 - /llvm/trunk/lib/CodeGen/LatencyPriorityQueue.cpp
Dan Gohman
gohman at apple.com
Mon Dec 8 16:26:46 PST 2008
Author: djg
Date: Mon Dec 8 18:26:46 2008
New Revision: 60733
URL: http://llvm.org/viewvc/llvm-project?rev=60733&view=rev
Log:
Don't charge full latency for an anti-dependence, in this simplistic
pipeline model.
Modified:
llvm/trunk/lib/CodeGen/LatencyPriorityQueue.cpp
Modified: llvm/trunk/lib/CodeGen/LatencyPriorityQueue.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LatencyPriorityQueue.cpp?rev=60733&r1=60732&r2=60733&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LatencyPriorityQueue.cpp (original)
+++ llvm/trunk/lib/CodeGen/LatencyPriorityQueue.cpp Mon Dec 8 18:26:46 2008
@@ -52,8 +52,9 @@
WorkList.push_back(&SU);
while (!WorkList.empty()) {
const SUnit *Cur = WorkList.back();
+ unsigned CurLatency = Cur->Latency;
bool AllDone = true;
- int MaxSuccLatency = 0;
+ unsigned MaxSuccLatency = 0;
for (SUnit::const_succ_iterator I = Cur->Succs.begin(),E = Cur->Succs.end();
I != E; ++I) {
int SuccLatency = Latencies[I->Dep->NodeNum];
@@ -61,11 +62,14 @@
AllDone = false;
WorkList.push_back(I->Dep);
} else {
- MaxSuccLatency = std::max(MaxSuccLatency, SuccLatency);
+ // This assumes that there's no delay for reusing registers.
+ unsigned NewLatency =
+ SuccLatency + ((I->isCtrl && I->Reg != 0) ? 1 : CurLatency);
+ MaxSuccLatency = std::max(MaxSuccLatency, NewLatency);
}
}
if (AllDone) {
- Latencies[Cur->NodeNum] = MaxSuccLatency + Cur->Latency;
+ Latencies[Cur->NodeNum] = MaxSuccLatency;
WorkList.pop_back();
}
}
More information about the llvm-commits
mailing list