This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Point empty %invoke.cont block to successor
ClosedPublic

Authored by vsk on Aug 27 2015, 12:54 PM.

Details

Summary

When partially initializing a global, exception-handling code in the frontend emits a placeholder %invoke.cont block with no terminator. This commit adds a suitable BranchInst to the block to prevent "malformed BasicBlock" errors.

A test case is included.

Note: I have been struggling to understand why throwing an error in a destructor causes exception-handling code to be generated when invoking the constructor [esp. when the constructor does not throw anything]. This patch is meant as a workaround until the 'real' issue can be addressed.

Diff Detail

Event Timeline

vsk updated this revision to Diff 33347.Aug 27 2015, 12:54 PM
vsk retitled this revision from to [CodeGen] Point empty %invoke.cont block to successor.
vsk updated this object.
vsk added reviewers: ygao, rsmith.
vsk added a subscriber: cfe-commits.
rnk added a subscriber: rnk.Sep 4 2015, 2:21 PM

I think a better fix would be to insert a non-terminator placeholder that doesn't confuse EmitBlock.

This revision was automatically updated to reflect the committed changes.