Skip to content

Commit e603f2d

Browse files
author
Andres Madrid Ucha
committed
PartialExecuter: Earlier check for children nodes reachability
Instead of making a call the recursiveVisit() function and then immediately returning when a child node is not reachable. It is better to check beforehand, and it is indeed not reachable, not call the recursive function.
1 parent e733271 commit e603f2d

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

llvm/lib/CheerpWriter/PartialExecuter.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,12 +1523,6 @@ class BasicBlockGroupNode
15231523
// Visit the tree of BasicBlockGroupNodes, starting from the root and visiting children depth-first
15241524
void recursiveVisit()
15251525
{
1526-
if (!isReachable)
1527-
{
1528-
// We are in an unreachable part of the graph
1529-
// --> Nothing to do
1530-
return;
1531-
}
15321526
if (isMultiHead)
15331527
{
15341528
// There are multiple BasicBlock that are reacheable from outside
@@ -1570,7 +1564,9 @@ class BasicBlockGroupNode
15701564
childrenNodes.pop_back();
15711565
while (!childrenNodes.empty())
15721566
{
1573-
childrenNodes.back().recursiveVisit();
1567+
auto& child = childrenNodes.back();
1568+
if (child.isReachable)
1569+
child.recursiveVisit();
15741570
childrenNodes.pop_back();
15751571
}
15761572
}

0 commit comments

Comments
 (0)