[LLVMdev] How to prevent duplication of function calls?

Dmitry Denisenko DDENISEN at altera.com
Thu Apr 14 14:24:40 PDT 2011


Hello,

Is it possible to prevent duplication of call sites for specific functions (while still maintaining -O3 optimization level)? For example, the following C code:

------------------
if (cond1) a=2;
llvm.memory.barrier(...);
------------------

is turned by clang with -O2 into something like this:

------------------
if (cond1)
          a=2;
          llvm.memory.barrier(...);
else
          llvm.memory.barrier(...);
------------------

We're doing C to HDL compilation with LLVM. Having multiple locations that call llvm.memory.barrier(...) would cause complications to generated hardware.

So far, I can think of only two solutions. One is to add support for something like "noclone" attribute and update all optimizations to obey it. The other is to re-merge the calls as a final pass. Any better ideas?

Thank you,
Dmitry


________________________________
Confidentiality Notice.
This message may contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution, or copying of this message, or any attachments, is strictly prohibited. If you have received this message in error, please advise the sender by reply e-mail, and delete the message and any attachments. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110414/6837da38/attachment.html>


More information about the llvm-dev mailing list