<div dir="ltr"><div>Hi, <br><br>I have a naive question in using LLVM. <br><br>Given an llvm::Function*, and an llvm::BranchInst* of the function, is their a simple, off-the-shelf procedure in LLVM for me to determine whether there is dependency between the branch instruction and the function’s input parameters? For example:<br><br></div><div><i>void foo(int n){</i></div><div><i> i=0; </i></div><div><i> if (i<=n){ //B1</i></div><div><i> i++;</i></div><div><i> }</i></div><div><i> int j=0</i></div><div><i> if (j<=2*j){ //B2</i></div><div><i> j++;</i></div><div><i> }</i></div><div><i> if (i+j>=1){ //B3</i></div><div><i> return;</i></div><div><i> }</i></div><div><i>return;</i></div><div><i>}</i></div><div><br></div><div>Here, the first branch B1 depends on the input ’n’; the second branch B2 does not depends on ’n’; and the third B3 depends (indirectly) on input ’n’ as it uses ‘i’. </div><div><br></div><div>Such static analysis can quickly become complicated, but maybe LLVM provides a simple, conservative solution for us. Can anyone tell me the right LLVM API to use. A simple example of the use would be the most helpful. <br><br>Thanks in advance. </div><div><div><div class="gmail_signature">Zhoulai</div></div>
</div>
</div>