[LLVMdev] unwinds to in the CFG

Nick Lewycky
Sat, 29 Mar 2008 04:57:49 -0000

Gordon Henriksen wrote:
> What blocks would a phi node in %catch require for a case like this?
>
>     define i8 @f(i1 %b) {
>
>     entry:
>
>       b label %try
>
>     try: unwinds to %catch
>
>       b i1 %b, label %then, label %else
>
>     then: unwinds to %catch
>
>       ret void
>
>     else: unwinds to %catch
>
>       ret void
>
>     catch:  ; What are my predecessors?
>
>       ret void
>
>     }

'catch' has 3 preds, %try, %then and %else.

>
>> B. redefine the dominator tree by modifying the GraphTraits
>>  i.  A dom B means that all instructions in A are guaranteed to
>> execute before any instructions in B.
>>  ii. the domtree may have multiple roots.
>>
>> Multiple roots occurs when the entry block 'unwinds to' another
block.
>
> It seems highly problematical that static allocas might not dominate
> their uses.

I'm not sure what you mean by that. It would be invalid to
"alloca" in a
BB then use the pointer in the unwind dest. You can't escape that.

  The entry block is already special in that it cannot be
used
> as a branch target. Why not also forbid 'unwinds to' on the entry
block?

Yes, we could also do that. I'm all for hearing arguments for and opposed.

Nick