[LLVMdev] Branch-like intrinsic

Chris Lattner sabre at nondot.org
Mon Apr 14 15:37:26 PDT 2008


On Mon, 14 Apr 2008, Edward Lee wrote:
> On Mon, Apr 14, 2008 at 5:11 PM, Chris Lattner <sabre at nondot.org> wrote:
>>  Why not something like:
>>    %x = llvm.myintrinsic()
>>    br i1 %x, label %T, label %F
> Right. That's exactly what I meant in the last paragraph of the
> original message.
>
> The reason for not wanting this is that %x actually always turns out
> to be 1 (on architectures that support it), so %T is always taken. But
> this unnecessarily adds overheads with the branch check. However, I do
> want the semantics of the code to be a conditional branch, so that
> optimization passes still know about the data flow going into %F.
>
> But it wouldn't be the end of the world if I went with this approach. :)

The code generator does CFG simplification to handle cases where blocks 
become dead during lowering.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list