[LLVMdev] How to decide whether a function is executed or not

lyh.kernel lyh.kernel at gmail.com
Tue May 20 07:19:32 PDT 2014


Hello everyone,

I want to decide whether a function is executed or not. For example (the
value of
cond is not determined at compile time):

br i1 %cond, label %if, label %else

if:
  ...
  call void f()
  ...
  br label %exit

else:
  ...
  br label %exit

We could say that function f is control dependent on cond and may not be
executed.

On the other hand:

br i1 %cond, label %if, label %else

if:
  ...
  call void f()
  ...
  br label %exit

else:
  ...
  call void f()
  ...
  br label %exit

No matter the value of cond is, function f would be executed.

I am wondering whether there exist any algorithm to decide whether function
f is
executed or not. Any suggestion or key word are appreciated.

Many thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140520/7fbda6e7/attachment.html>


More information about the llvm-dev mailing list