[Patch] Add TargetLibraryInfo in LTO passes builder

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Dec 9 14:46:33 PST 2013

On Dec 9, 2013, at 2:24 PM, Yi Jiang <yjiang at apple.com> wrote:

> Hi Duncan,
> Thank you for your information. However, I found the function body will be kept only we specify target triple = "x86_64-unknown-linux-gnu" in the source file. The function body will be cleaned up if we specify something like target triple = "x86_64-apple-darwin12.5.0".  It is the same behavior on  test/LTO/cfi_endproc.ll and my own test case, Do you know the reason? Thank you!

Different target triples name symbols differently.  You can probably use -exported-symbol=_foo.

Alternatively, you can append to @llvm.used [1].  This will allow -internalize to run, but will prevent -ipsccp and -globalopt from treating the functions as dead code.

[1]: http://llvm.org/docs/LangRef.html#the-llvm-used-global-variable

More information about the llvm-commits mailing list