Skip to content

Commit 90981f4

Browse files
author
Andres Madrid Ucha
committed
PartialExecuter: Avoid copying subsets in SplitIntoSCCS
Instead of constructing a subset and then copying it into subsets, we can construct it locally and std::move it into subsets. This is safe because the subset has no usage outside this scope, and all the places where we were using it now refer to the moved-subset (subsets.back())
1 parent ec3f763 commit 90981f4

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

llvm/lib/CheerpWriter/PartialExecuter.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,7 +1668,6 @@ void BasicBlockGroupNode::splitIntoSCCs(std::list<BasicBlockGroupNode>& queueToB
16681668
queueToBePopulated.emplace_back(data, this, blocks);
16691669
blockToGroupMap[bb] = &queueToBePopulated.back();
16701670
blockToGroupMap[start] = &queueToBePopulated.front();
1671-
subsetIndex[start] = 0;
16721671
return;
16731672
}
16741673

@@ -1685,10 +1684,10 @@ void BasicBlockGroupNode::splitIntoSCCs(std::list<BasicBlockGroupNode>& queueToB
16851684
subset.insert(bb);
16861685
subsetIndex[bb] = nextId;
16871686
}
1688-
subsets.push_back(subset);
1687+
subsets.push_back(std::move(subset));
16891688
nextId++;
1690-
queueToBePopulated.emplace_back(data, this, subset);
1691-
for (BasicBlock* bb : subset)
1689+
queueToBePopulated.emplace_back(data, this, subsets.back());
1690+
for (BasicBlock* bb : subsets.back())
16921691
{
16931692
blockToGroupMap[bb] = &queueToBePopulated.back();
16941693
}

0 commit comments

Comments
 (0)