Hi all, LLVM is smart that it can synthesize llvm.memset, llvm.memcpy etc. from loops, which can be lowered into calls to memset, memcpy and so on. Is there an option that can disable this optimization? For some cases, I do not want the code to depend on libc. Thanks in advance! Bin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130730/ecdb07f5/attachment.html>
If you're using just LLVM, you can simply not run optimizations like LoopIdiomRecognizer that synthesize these operations. Assuming you mean clang+LLVM, you can use -ffreestanding to achieve most of what you want, but note that LLVM matches GCC in that it requires certain functions to have expansions available for linking. If that's not workable for your target, you'll need to modify clang itself to omit those optimizations. From http://gcc.gnu.org/onlinedocs/gcc/Standards.html> GCC requires the freestanding environment provide memcpy, memmove, memset and memcmp.--Owen On Jul 30, 2013, at 10:55 AM, Bin Tzeng <bintzeng at gmail.com> wrote:> Hi all, > > LLVM is smart that it can synthesize llvm.memset, llvm.memcpy etc. from loops, which can be lowered into calls to memset, memcpy and so on. Is there an option that can disable this optimization? For some cases, I do not want the code to depend on libc. > > Thanks in advance! > Bin > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130730/3bf79ce8/attachment.html>
On 7/30/2013 12:55 PM, Bin Tzeng wrote:> Hi all, > > LLVM is smart that it can synthesize llvm.memset, llvm.memcpy etc. from > loops, which can be lowered into calls to memset, memcpy and so on. Is > there an option that can disable this optimization? For some cases, I do > not want the code to depend on libc.You can use -fno-builtin, if that suits your needs. -K -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Thanks! That works. On Tue, Jul 30, 2013 at 11:01 AM, Krzysztof Parzyszek < kparzysz at codeaurora.org> wrote:> On 7/30/2013 12:55 PM, Bin Tzeng wrote: > >> Hi all, >> >> LLVM is smart that it can synthesize llvm.memset, llvm.memcpy etc. from >> loops, which can be lowered into calls to memset, memcpy and so on. Is >> there an option that can disable this optimization? For some cases, I do >> not want the code to depend on libc. >> > > You can use -fno-builtin, if that suits your needs. > > -K > > -- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted > by The Linux Foundation > > ______________________________**_________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130730/56da0447/attachment.html>