[LLVMdev] Fwd: LLVM IR Branchs

Eli Friedman eli.friedman at gmail.com
Mon Sep 5 17:28:32 PDT 2011


On Mon, Sep 5, 2011 at 5:25 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Mon, Sep 5, 2011 at 5:13 PM, Rafael Baldiati Parizi
> <parizi.computacao at gmail.com> wrote:
>> I have two values and I want see if them are equals. Then, I would a
>> instruction like
>> if Value1 != Value2, error
>> without create a new block, continuing the execution in the same block,
>> forcing the LLI to execute this.
>
> You can't do that; a br instruction must be at the end of a block.
>
> Splitting a block is trivial, though: the C++ API provides SplitBlock,
> and if you're just manipulating the text, you can insert a br to a
> label immediately followed by that label anywhere in any function
> without changing the semantics of the program.

Err, strictly speaking, not anywhere... you can't split a block before
a PHI node or a landingpad.  But otherwise, there are no restrictions.

-Eli



More information about the llvm-dev mailing list