This is an archive of the discontinued LLVM Phabricator instance.

Teach SplitBlockPredecessors how to handle landingpad blocks.
ClosedPublic

Authored by igor-laevsky on Jan 23 2015, 6:28 PM.

Details

Summary

Currently SplitBlockPredecessors generates incorrect code in case if basic block we are going to split has a landingpad. Also seems like it is fairly common case among it's users to conditionally call either SplitBlockPredecessors or SplitLandingPadPredecessors. Because of this I think it is reasonable to add this condition directly into SplitBlockPredecessors.

Diff Detail

Repository
rL LLVM

Event Timeline

igor-laevsky retitled this revision from to Teach SplitBlockPredecessors how to handle landingpad blocks..
igor-laevsky updated this object.
igor-laevsky edited the test plan for this revision. (Show Details)
igor-laevsky added a reviewer: reames.
igor-laevsky set the repository for this revision to rL LLVM.
igor-laevsky added a subscriber: Unknown Object (MLST).
reames edited edge metadata.Jan 26 2015, 2:56 PM

Minor comments inline. Once these are addressed, I'm willing to give an LGTM. As we discussed offline, I plan on waiting another day or two to give other interested parties time to comment.

include/llvm/Transforms/Utils/BasicBlockUtils.h
205

I'd suggest organizing the comment as:
This method returns <high level comment, true of each>. The specific transform performed depends on whether BB starts with a landingpad instruction.

If BB does not contain a landingpad ....

If BB does start with a landingpad ...

208

Given there is no longer a NumPreds argument, you can delete that part.

lib/Transforms/Utils/BasicBlockUtils.cpp
457

Given this is just duplicated from the header, delete the comment here.

480

Not sure it makes sense to add the extra suffix here. I'd just drop this.

igor-laevsky edited edge metadata.

LGTM, per offline discussion, I will commit on your behalf.

This revision was automatically updated to reflect the committed changes.