[llvm-commits] [llvm] r61344 - /llvm/trunk/lib/CodeGen/ScheduleDAG.cpp
Dan Gohman
gohman at apple.com
Mon Dec 22 13:11:34 PST 2008
Author: djg
Date: Mon Dec 22 15:11:33 2008
New Revision: 61344
URL: http://llvm.org/viewvc/llvm-project?rev=61344&view=rev
Log:
Optimize setDepthDirty and setHeightDirty a little, as they showed
up on a profile.
Modified:
llvm/trunk/lib/CodeGen/ScheduleDAG.cpp
Modified: llvm/trunk/lib/CodeGen/ScheduleDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAG.cpp?rev=61344&r1=61343&r2=61344&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ScheduleDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/ScheduleDAG.cpp Mon Dec 22 15:11:33 2008
@@ -119,29 +119,35 @@
}
void SUnit::setDepthDirty() {
+ if (!isDepthCurrent) return;
SmallVector<SUnit*, 8> WorkList;
WorkList.push_back(this);
- while (!WorkList.empty()) {
+ do {
SUnit *SU = WorkList.pop_back_val();
- if (!SU->isDepthCurrent) continue;
SU->isDepthCurrent = false;
for (SUnit::const_succ_iterator I = SU->Succs.begin(),
- E = SU->Succs.end(); I != E; ++I)
- WorkList.push_back(I->getSUnit());
- }
+ E = SU->Succs.end(); I != E; ++I) {
+ SUnit *SuccSU = I->getSUnit();
+ if (SuccSU->isDepthCurrent)
+ WorkList.push_back(SuccSU);
+ }
+ } while (!WorkList.empty());
}
void SUnit::setHeightDirty() {
+ if (!isHeightCurrent) return;
SmallVector<SUnit*, 8> WorkList;
WorkList.push_back(this);
- while (!WorkList.empty()) {
+ do {
SUnit *SU = WorkList.pop_back_val();
- if (!SU->isHeightCurrent) continue;
SU->isHeightCurrent = false;
for (SUnit::const_pred_iterator I = SU->Preds.begin(),
- E = SU->Preds.end(); I != E; ++I)
- WorkList.push_back(I->getSUnit());
- }
+ E = SU->Preds.end(); I != E; ++I) {
+ SUnit *PredSU = I->getSUnit();
+ if (PredSU->isHeightCurrent)
+ WorkList.push_back(PredSU);
+ }
+ } while (!WorkList.empty());
}
/// setDepthToAtLeast - Update this node's successors to reflect the
More information about the llvm-commits
mailing list