[LLVMdev] unwinds to in the CFG

Duncan Sands
Thu, 03 Apr 2008 17:58:45 -0000

Hi Devang,

> > Just as a quick recap the problem I encountered is how to deal
> > instructions in a block being used as operands in the unwind dest.
> > Such
> > as this:
> >
> > bb1: unwinds to %cleanup
> >   call void @foo() ; might throw, might not
> >   %x = add i32 %y, %z
> >   call void @foo() ; might throw, might not
> >   ret void
> > cleanup:
> >   call void @use(i32 %x)
> >
> > The problem is that %x might not have been executed before we enter
> > %cleanup.
>
> This means bb1 has multiple exit points, which defeats the "single
> entry, single exit" idea. Did I miss anything here ?

you are correct, this fundamental property of basic blocks is being
discarded.  Very nasty!  This is why I argued against this approach
in favour of the mini-basic-blocks approach, in which you have lots
of basic blocks which under the hood share common info to reduce memory
usage.  However Chris convinced me that in fact not that many places
really use that there is a single exit, and that only a wimpy quiche
eater would shrink at the idea of auditing all of LLVM! :)

Ciao,

Duncan.