[llvm-dev] EmitTargetCodeForMemSet & LTO issue

Romaric Jodin via llvm-dev llvm-dev at lists.llvm.org
Fri Aug 28 08:25:51 PDT 2020

Hi everyone,

I have 2 implementations of "memset". A standard one, and another one
optimized when the pointer and the size respect some specific constraints.
I am able to choose the proper one in the "EmitTargetCodeForMemSet" method
that I implemented for my backend.

My issue is when I am compiling with the LTO optimisation, the linker tells
me that the optimized memset symbol is undefined ("*ld.lld: error:
undefined symbol: __memset_opt*"). I've looked into theLTO archive used and
I found both memset functions.

It feels like when the compiler gets in "EmitTargetCodeForMemSet", it has
already forgotten about the optimized memset function that was in the
archive because it was not used initially.

Any idea why?

Thanks in advance,
JODIN Romaric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200828/adaaafa8/attachment.html>

More information about the llvm-dev mailing list