Skip to content

Commit

Permalink
fix: speed up switch processing by skip not relevant exits (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Feb 16, 2020
1 parent 519a74e commit 1336c47
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -865,10 +865,12 @@ private static BlockNode calcPostDomOut(MethodNode mth, BlockNode block, List<Bl
// slow search: calculate partial post-dominance for every exit node
BitSet ipdoms = BlockUtils.newBlocksBitSet(mth);
for (BlockNode exitBlock : exits) {
Set<BlockNode> pathBlocks = BlockUtils.getAllPathsBlocks(block, exitBlock);
BlockNode ipdom = BlockUtils.calcPartialImmediatePostDominator(mth, block, pathBlocks, exitBlock);
if (ipdom != null) {
ipdoms.set(ipdom.getId());
if (BlockUtils.isAnyPathExists(block, exitBlock)) {
Set<BlockNode> pathBlocks = BlockUtils.getAllPathsBlocks(block, exitBlock);
BlockNode ipdom = BlockUtils.calcPartialImmediatePostDominator(mth, block, pathBlocks, exitBlock);
if (ipdom != null) {
ipdoms.set(ipdom.getId());
}
}
}
outs.and(ipdoms);
Expand Down

0 comments on commit 1336c47

Please # to comment.