Skip to content

Commit

Permalink
Fixing wrong order in removeUnreachableBlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Away-pp committed Jan 20, 2024
1 parent 61be1d8 commit 44e9316
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -654,13 +654,14 @@ private static void removeUnreachableBlocks(MethodNode mth) {
return;
}

toRemove.forEach(BlockSplitter::detachBlock);
mth.getBasicBlocks().removeAll(toRemove);
long notEmptyBlocks = toRemove.stream().filter(block -> !block.getInstructions().isEmpty()).count();
if (notEmptyBlocks != 0) {
int insnsCount = toRemove.stream().mapToInt(block -> block.getInstructions().size()).sum();
mth.addWarnComment("Unreachable blocks removed: " + notEmptyBlocks + ", instructions: " + insnsCount);
}

toRemove.forEach(BlockSplitter::detachBlock);
mth.getBasicBlocks().removeAll(toRemove);
}

private static void clearBlocksState(MethodNode mth) {
Expand Down

0 comments on commit 44e9316

Please sign in to comment.