fix: use correct order in removeUnreachableBlocks (PR #2085)
* Fixing wrong order in removeUnreachableBlocks * Removing dead code in TestTernary4 test * Do not clear instructions in detach blocks method
This commit is contained in:
@@ -654,13 +654,14 @@ public class BlockProcessor extends AbstractVisitor {
|
||||
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) {
|
||||
|
||||
@@ -455,7 +455,6 @@ public class BlockSplitter extends AbstractVisitor {
|
||||
successor.getPredecessors().remove(block);
|
||||
}
|
||||
block.add(AFlag.REMOVE);
|
||||
block.getInstructions().clear();
|
||||
block.getPredecessors().clear();
|
||||
block.getSuccessors().clear();
|
||||
}
|
||||
|
||||
@@ -133,8 +133,6 @@
|
||||
.catchall {:try_start_14 .. :try_end_50} :catchall_4e
|
||||
|
||||
throw p1
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private getValueObject(Ljava/lang/String;)Ljava/lang/Object;
|
||||
|
||||
Reference in New Issue
Block a user