1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

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
This commit is contained in:
Dan Gohman 2009-02-11 00:12:28 +00:00
parent 0da8292c67
commit d5561e2f28

View File

@ -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;