[LLVMdev] Fwd: LLVM IR Branchs

Nick Lewycky nicholas at mxc.ca
Mon Sep 5 17:30:59 PDT 2011


Rafael Baldiati Parizi 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 not. The definition of a "basic block" is a sequence of 
instructions with a single entry and a single exit. You can not insert 
multiple exits within a basic block.

I realize that this restriction feels arbitrary, but there's a vast 
amount of research and practical experience in compiler design built 
around the notion of basic blocks making up a control flow graph.

Nick

> 2011/9/5 Eli Friedman <eli.friedman at gmail.com
> <mailto:eli.friedman at gmail.com>>
>
>     On Mon, Sep 5, 2011 at 4:47 PM, Rafael Baldiati Parizi
>     <parizi.computacao at gmail.com <mailto:parizi.computacao at gmail.com>>
>     wrote:
>      > Hello,
>      > I would know how can I make a branch in llvm ir without a label of
>      > destination?
>      > For example:
>      > br i1 %1, label %bb,  NO LABEL HERE
>
>     What are you trying to do?
>
>     -Eli
>
>
>
>
> --
> */Rafael Parizi/*
>
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list