Skip to content

Commit a97fa00

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 0b550c3 commit a97fa00

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

llvm/lib/CheerpWriter/PartialExecuter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,10 +1684,10 @@ void BasicBlockGroupNode::splitIntoSCCs(std::list<BasicBlockGroupNode>& queueToB
16841684
subset.insert(bb);
16851685
subsetIndex[bb] = nextId;
16861686
}
1687-
subsets.push_back(subset);
1687+
subsets.push_back(std::move(subset));
16881688
nextId++;
1689-
queueToBePopulated.emplace_back(data, this, subset);
1690-
for (BasicBlock* bb : subset)
1689+
queueToBePopulated.emplace_back(data, this, subsets.back());
1690+
for (BasicBlock* bb : subsets.back())
16911691
{
16921692
blockToGroupMap[bb] = &queueToBePopulated.back();
16931693
}

0 commit comments

Comments
 (0)