[LLVMdev] RFC: Exception Handling Rewrite

Jakob Stoklund Olesen stoklund at 2pi.dk
Sat Jul 23 02:00:16 PDT 2011

On Jul 23, 2011, at 1:11 AM, Bill Wendling wrote:

> On Jul 22, 2011, at 11:44 PM, Jakob Stoklund Olesen wrote:
>> Could we add:
>> - A landing pad block is not the destination of any other kind of terminator. Only unwind edges are allowed.
>> - The landingpad instruction must only appear at the top of a landing pad. It cannot appear in any other block, or following non-phi instructions.
> Most of this is covered by 2&3. But it would be good to explicitly state that a landingpad instruction can appear only in a landing pad block.

Right. I think we agree on the intention. I wanted to make it completely clear that:

- All unwind edges go to a block with a landingpad instruction.
- All non-unwind edges go to a block without a landingpad instruction.

That then implies that unwind edges can't be split and landingpad instructions can't be moved.

>> Why won't SplitCriticalEdge work for landing pads? Does it require more than splitting the landing pad after the landingpad instruction, and duplicating the top half? Alternatively, could we get a SplitLandingPad function?
> Splitting a critical edge, especially in this case, isn't necessary for correctness. It's an optimization.

Yes. You scared me with 'requires considerable care'. Does that mean anything other than 'you have to duplicate the landing pad instead of splitting the unwind edge'. Is special magic required to duplicate a landingpad instruction?

> In general, the use of a value in the catch blocks will access that value via memory.

Because the register allocator will spill, or because mem2reg fails? Won't there be a lot of IR values live across an unwind edge after mem2reg?

> It also complicates the SplitCriticalEdge function, like you outlined.

Yes, I agree. Duplicating a landing pad is different than splitting a critical edge.

>> Will it be possible to split landing pads during codegen?
> Split a landing pad or split the critical edges to a landing pad?

Sorry, I meant duplicating a landing pad.

Landing pads notoriously collect critical edges. We should make sure there is some way of dealing with that, unlike indirectbr edges. The possibility of splitting and duplicating landing pads would help.


More information about the llvm-dev mailing list