[LLVMdev] unwinds to in the CFG
Nick Lewycky
nicholas at mxc.ca
Fri Mar 28 21:49:28 PDT 2008
Duncan Sands wrote:
> Hi Nick,
>
>> 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.
>
> how about just declaring this illegal? i.e. require the first call
> to be in a different basic block to the second, making it possible
> to use a phi node in %cleanup.
Because it's extremely difficult for an optimization pass to maintain
that guarantee, it's expensive to scan through the instruction list
sequentially, and it leads to additional basic blocks.
I agree that the snippet should be illegal, but I don't think this is
the way to do it.
Nick
More information about the llvm-dev
mailing list