File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -645,13 +645,7 @@ struct CodeFolding
645645 if (tails.size () < 2 ) {
646646 return false ;
647647 }
648- // Compute body branch targets once and share across recursive calls to
649- // avoid repeated O(N) tree walks.
650648 BranchUtils::NameSet localBodyTargets;
651- if (!bodyTargets) {
652- localBodyTargets = BranchUtils::getBranchTargets (getFunction ()->body );
653- bodyTargets = &localBodyTargets;
654- }
655649 // remove things that are untoward and cannot be optimized
656650 tails.erase (
657651 std::remove_if (tails.begin (),
@@ -811,6 +805,13 @@ struct CodeFolding
811805 // as the changes may influence us. we leave further opts to further
812806 // passes (as this is rare in practice, it's generally not a perf
813807 // issue, but TODO optimize)
808+ // Compute body branch targets once and share across recursive
809+ // calls to avoid repeated O(N) tree walks.
810+ if (!bodyTargets) {
811+ localBodyTargets =
812+ BranchUtils::getBranchTargets (getFunction ()->body );
813+ bodyTargets = &localBodyTargets;
814+ }
814815 if (optimizeTerminatingTails (explore, num + 1 , bodyTargets)) {
815816 return true ;
816817 }
You can’t perform that action at this time.
0 commit comments