[LLVMdev] RFC: Exception Handling Proposal II

John McCall rjmccall at apple.com
Sun Nov 28 16:15:46 PST 2010


On Nov 28, 2010, at 6:23 AM, Renato Golin wrote:
> On 28 November 2010 10:20, Bill Wendling <wendling at apple.com> wrote:
>> Or am I missing something? :-)
> 
> Hi Bill, John,
> 
> There still seems to be a confusion between clean-ups and catch areas.
> What you both describe are catch areas, on which your arguments
> (AFAICS) are perfectly valid. The distinction is between catch and
> clean-up areas.

Two points.

First, we're talking about how basic dominance rules work.  Catch handlers
will be dominated by protected blocks *through* the landing pads, so whether
a value is legal to access in all the EH cleanups determines whether that
value is legal to access in the handler.  We are not going to have different
dominance rules for "user code" vs. "non-user code";  frontends and
optimizers are required to maintain well-formedness for all.

Second, while you are correct to say that code motion into cleanup areas
is generally unsafe, you are ignoring more likely ways that cleanups would
become dependent on values not defined in the entry block.  The first is
that there are several places in C++ (and presumably also Ada) where
a cleanup is required on the return value of a function call;  most notably,
a new-expression which throws after allocating memory must call the
paired 'operator delete' on the allocated pointer.  The second is the
inliner in combination with mem2reg or SROA.

John.



More information about the llvm-dev mailing list