summaryrefslogtreecommitdiff
path: root/lib/CodeGen/ScheduleDAG.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-02-11 00:12:28 +0000
committerDan Gohman <gohman@apple.com>2009-02-11 00:12:28 +0000
commit5cffa6fe271351a8fd80e7767b5d61a999acfa9b (patch)
treeabe7a52bb0e549d1eae04b3e2d60981fd3f0f842 /lib/CodeGen/ScheduleDAG.cpp
parentbed353d0163a6b17beecc20c23b67de9b06e7b5c (diff)
downloadllvm-5cffa6fe271351a8fd80e7767b5d61a999acfa9b.tar.gz
llvm-5cffa6fe271351a8fd80e7767b5d61a999acfa9b.tar.bz2
llvm-5cffa6fe271351a8fd80e7767b5d61a999acfa9b.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ScheduleDAG.cpp')
-rw-r--r--lib/CodeGen/ScheduleDAG.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/ScheduleDAG.cpp b/lib/CodeGen/ScheduleDAG.cpp
index f9b9408354..db7d92218b 100644
--- a/lib/CodeGen/ScheduleDAG.cpp
+++ b/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;