<div dir="ltr"><div><div><div>Hello,<br><br></div>I should think that it is undecidable: it looks like a variant of the Halting Problem.<br><br></div>Consider a function which contains an infinite loop: any algorithm which could determine whether that function is called or not would effectively be an algorithm that could determine whether the program containing that function halts or not.  Equally, deciding whether the function contains an infinite loop or not is itself an instance of the Halting Problem. <br>
<br></div>    Richard<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 20 May 2014 15:19, lyh.kernel <span dir="ltr"><<a href="mailto:lyh.kernel@gmail.com" target="_blank">lyh.kernel@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello everyone, <div><br></div><div>I want to decide whether a function is executed or not. For example (the value of</div>
<div>cond is not determined at compile time):</div><div><br></div><div>br i1 %cond, label %if, label %else</div>
<div><br></div><div>if:</div><div>  ...</div><div>  call void f()</div><div>  ...</div><div>  br label %exit</div><div><br></div><div>else:</div><div>  ...</div><div>  br label %exit<br></div><div><br></div><div>We could say that function f is control dependent on cond and may not be </div>

<div>executed.</div><div><br></div><div>On the other hand:</div><div><br></div><div><div>br i1 %cond, label %if, label %else</div><div><br></div><div>if:</div><div>  ...</div><div>  call void f()</div><div>  ...</div><div>

  br label %exit</div><div><br></div><div>else:</div><div>  ...</div><div>  call void f()</div><div>  ...</div><div>  br label %exit</div></div><div><br></div><div>No matter the value of cond is, function f would be executed.<br>

</div><div><br></div><div>I am wondering whether there exist any algorithm to decide whether function f is </div><div>executed or not. Any suggestion or key word are appreciated.</div><div><br></div><div>Many thanks</div>

</div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>