[llvm-commits] [llvm] r64262 - /llvm/trunk/lib/CodeGen/ScheduleDAG.cpp
Dan Gohman
gohman at apple.com
Tue Feb 10 16:12:29 PST 2009
Author: djg
Date: Tue Feb 10 18:12:28 2009
New Revision: 64262
URL: http://llvm.org/viewvc/llvm-project?rev=64262&view=rev
Log:
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.
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=64262&r1=64261&r2=64262&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ScheduleDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/ScheduleDAG.cpp Tue Feb 10 18:12:28 2009
@@ -74,8 +74,9 @@
/// 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;
More information about the llvm-commits
mailing list