[LLVMdev] RFC: Exception Handling Proposal II

Renato Golin rengolin at systemcall.org
Sun Nov 28 14:34:53 PST 2010


On 28 November 2010 22:14, Bill Wendling <wendling at apple.com> wrote:
> If we have a basic block that may throw and is caught by some landing pad, what variables may be used in that landing pad – both the cleanup part and the catch handler? Certainly the cleanup cannot access the user variables directly (but can indirectly if a pointer is passed into an object which is then dereferenced by the d'tor).

A clean-up landing pad should never (IMHO, not even after
optimizations) handle user variables, especially not indirectly.

But again, that's perhaps my C++-istic view of exception handling. It
might make sense in other languages...


> But the catch handlers are dominated by the landing pad, which would need to be dominated by the throwing basic block in order to use any values calculated in that basic block.

That's a fair point. Ignore them just because they're special would
complicate the CFG analysis for little gain, and could even get in the
way of inlining the whole EH block.


> One possibility (perhaps this is what he meant) is that if a value is used in the catch handler, then it cannot reside in the throwing block.

If the value is guaranteed never to throw an exception and not to have
any side-effects, I guess that's ok. Otherwise, it could change the
state of the program in unpredictable ways.

cheers,
--renato




More information about the llvm-dev mailing list