This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG] Skip merging return blocks if it would break a CallBr.
ClosedPublic

Authored by jonpa on Mar 4 2020, 8:56 AM.

Details

Summary

SimplifyCFG should not merge empty return blocks and leave a CallBr behind with a duplicated destination since the verifier will then trigger an assert. This patch checks for this case and avoids the transformation.

CodeGenPrepare has a similar check which also has a FIXME comment about why this is needed. It seems perhaps better if these two passes would eventually instead update the CallBr instruction instead of just checking and avoiding.

This fixes https://bugs.llvm.org/show_bug.cgi?id=45062.

Diff Detail

Event Timeline

jonpa created this revision.Mar 4 2020, 8:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2020, 8:56 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
jonpa added a reviewer: spatel.Mar 9 2020, 6:10 AM
This revision is now accepted and ready to land.Mar 9 2020, 9:50 AM
This revision was automatically updated to reflect the committed changes.