[LLVMdev] How to Check whether BasicBlock resides in a conditional branch

Jianfei Hu hujianfei258 at gmail.com
Sat Aug 25 20:18:43 PDT 2012


Thanks, I may have a try.

2012/8/25 Das, Dibyendu <Dibyendu.Das at amd.com>:
> In the general sense you may get some help by looking at the control dependence graph.
> - dibyendu
>
> ----- Original Message -----
> From: Jianfei Hu [mailto:hujianfei258 at gmail.com]
> Sent: Saturday, August 25, 2012 07:43 AM
> To: LLVMdev at cs.uiuc.edu <LLVMdev at cs.uiuc.edu>
> Subject: [LLVMdev] How to Check whether BasicBlock resides in a conditional     branch
>
> Hello All,
>
> I want to dertermine whether a basicblock is in a conditional branch. such as,
>
> //=============================
> if a > 2 // BasicBlock A
> then
>
> BasicBlock B
>
> endif
>
> BasicBlock C
> //=============================
> What I want to identify is BasicBlock B, which is in a condtional
> block. but C is not.
> In other words, I want to distinguish BasicBlocks that  * must *  be
> executed and that *may* be executed.
>
> CFG's iterator may not help, as  LLVM IR br would be:
> A:
> br %cmp,  %lable.B,  %label.C
>
> B
> br C
>
> C
>
> both of the blocks could be operand of br instruction.
>
> code in C *must be executed*, but B is not.
>
>
> Is there any availiable API in LLVM to distinguish them?
>
> Thanks.
> _______________________________________________
> 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