[LLVMdev] Prevent clang from replacing code with library calls

David Sela sela.david at gmail.com
Mon Aug 4 02:19:56 PDT 2014


Clang optimizes code by replacing some parts with efficient library
functions.

For example the following code:

for (i=0;i<size;++i)
       dest[i]=src[i];

will be compiled to (target=ARM assembly):

bl      __aeabi_memcpy(PLT)

The compile cmd:

/usr/share/android-arm-l14-toolchain/bin/clang31 -cc1 -triple
arm-none-linux-androideabi -S -target-abi aapcs-linux -target-cpu arm1022e
-backend-option -arm-enable-ehabi -backend-option
-arm-enable-ehabi-descriptors -backend-option -arm-ignore-has-ras
-internal-isystem
/usr/share/android-arm-l14-toolchain/lib/clang/3.1/include
-internal-externc-isystem
/usr/share/android-arm-l14-toolchain/bin/../sysroot/usr/include -o
myMemcpy.s -x c myMemcpy.c


Is there a flag or some other way to prevent the compiler from replacing
the code with library calls?


Thanks in advance,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140804/0cafbfa2/attachment.html>


More information about the llvm-dev mailing list