fix: removeUnreachable not searching in all blocks (PR #2082)

Co-authored-by: Away-pp <vladimir@DESKTOP-KESF23K>
This commit is contained in:
Away
2024-01-14 18:07:39 +01:00
committed by GitHub
parent 03052baabe
commit 2805770510
@@ -644,14 +644,13 @@ public class BlockProcessor extends AbstractVisitor {
}
private static void removeUnreachableBlocks(MethodNode mth) {
Set<BlockNode> toRemove = null;
Set<BlockNode> toRemove = new LinkedHashSet<>();
for (BlockNode block : mth.getBasicBlocks()) {
if (block.getPredecessors().isEmpty() && block != mth.getEnterBlock()) {
toRemove = new LinkedHashSet<>();
BlockSplitter.collectSuccessors(block, mth.getEnterBlock(), toRemove);
}
}
if (toRemove == null || toRemove.isEmpty()) {
if (toRemove.isEmpty()) {
return;
}