[PATCH] D14308: [SimplifyCFG] Extend SimplifyResume to handle phi of trivial landing pad.

Chen Li via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 11:44:48 PST 2015


chenli updated this revision to Diff 39572.
chenli added a comment.

First, fix the issues mentioned by David.

Second, the previous patch turned out to have a bug by running some of my own local tests. The patch tried to erase all unreachable landing pad blocks, but this invalidated the iteration of SimplifyCFG pass.

  if (SimplifyCFG(&*BBIt++, TTI, BonusInstThreshold, AC)) {
    LocalChange = true;
    ++NumSimpl;
  }

The next block has been iterated before processing the current block (in this case it is the resume block). If the next block turns out to be an unreachable landing pad block deleted by processing the resume block, the iteration will be broken. Therefore, we can only erase the current block in SimplifyCFG.

The updated patch fixes this problem, and modify the test’s block layout to catch this bug if it happens.


http://reviews.llvm.org/D14308

Files:
  lib/Transforms/Utils/SimplifyCFG.cpp
  test/Transforms/SimplifyCFG/bug-25299.ll
  test/Transforms/SimplifyCFG/invoke_unwind.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14308.39572.patch
Type: text/x-patch
Size: 7312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151106/3eadd0d3/attachment.bin>


More information about the llvm-commits mailing list