summaryrefslogtreecommitdiff
path: root/lib/CodeGen/ScheduleDAG.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-12-22 21:11:33 +0000
committerDan Gohman <gohman@apple.com>2008-12-22 21:11:33 +0000
commit8044e9b3af6e62afe89cd60bf76de22ae7138306 (patch)
tree808527208336076df1b95321b72d6a00c5c21a47 /lib/CodeGen/ScheduleDAG.cpp
parent361c31da5e9bd70d6b336207056519af9ff94062 (diff)
downloadllvm-8044e9b3af6e62afe89cd60bf76de22ae7138306.tar.gz
llvm-8044e9b3af6e62afe89cd60bf76de22ae7138306.tar.bz2
llvm-8044e9b3af6e62afe89cd60bf76de22ae7138306.tar.xz
Optimize setDepthDirty and setHeightDirty a little, as they showed
up on a profile. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61344 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ScheduleDAG.cpp')
-rw-r--r--lib/CodeGen/ScheduleDAG.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/CodeGen/ScheduleDAG.cpp b/lib/CodeGen/ScheduleDAG.cpp
index 3ec538cf2f..8630cfee7d 100644
--- a/lib/CodeGen/ScheduleDAG.cpp
+++ b/lib/CodeGen/ScheduleDAG.cpp
@@ -119,29 +119,35 @@ void SUnit::removePred(const SDep &D) {
}
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