diff options
| author | Dan Gohman <gohman@apple.com> | 2009-02-11 00:12:28 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-02-11 00:12:28 +0000 |
| commit | 27fa408b64edcfb5e8e13e4ede14121a632e2dd6 (patch) | |
| tree | e28534f6e687b5771f30403e0f3e7e4c5127e597 /llvm/lib/CodeGen | |
| parent | a3d9025dd389b069d03bcdaaa91d35e5579244f3 (diff) | |
| download | bcm5719-llvm-27fa408b64edcfb5e8e13e4ede14121a632e2dd6.tar.gz bcm5719-llvm-27fa408b64edcfb5e8e13e4ede14121a632e2dd6.zip | |
Use iterators to iterate through the Preds array instead of
an index. This code is on the hot-path because the current
way SDep edges are uniqued has quadratic complexity.
llvm-svn: 64262
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/ScheduleDAG.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/ScheduleDAG.cpp b/llvm/lib/CodeGen/ScheduleDAG.cpp index f9b94083548..db7d92218b3 100644 --- a/llvm/lib/CodeGen/ScheduleDAG.cpp +++ b/llvm/lib/CodeGen/ScheduleDAG.cpp @@ -74,8 +74,9 @@ void ScheduleDAG::Run(SelectionDAG *dag, MachineBasicBlock *bb, /// specified node. void SUnit::addPred(const SDep &D) { // If this node already has this depenence, don't add a redundant one. - for (unsigned i = 0, e = (unsigned)Preds.size(); i != e; ++i) - if (Preds[i] == D) + for (SmallVector<SDep, 4>::const_iterator I = Preds.begin(), E = Preds.end(); + I != E; ++I) + if (*I == D) return; // Now add a corresponding succ to N. SDep P = D; |

