ed at modk.it
2015-Jul-16 20:26 UTC
[LLVMdev] [Clang] [lld] [llvm-link] Whole program / dead-code optimization
> > > Is there a reason why LLVM's link-time optimization won't work for you? > > http://llvm.org/docs/GoldPlugin.html > http://llvm.org/docs/LinkTimeOptimization.html > >Well the primary motivation to move to LLVM is licensing which is why we also ditched binutils since we can't package gcc for iOS due to the GPL. So in the end the gold plugin wouldn't work for licensing reasons even if we can get it to work technically but thanks for the links I'm still trying to wrap my head around the problem and any info helps. -Ed -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150716/d3231b70/attachment.html>
Nick Lewycky
2015-Jul-17 06:15 UTC
[LLVMdev] [Clang] [lld] [llvm-link] Whole program / dead-code optimization
ed at modk.it wrote:> > Is there a reason why LLVM's link-time optimization won't work for you? > > http://llvm.org/docs/GoldPlugin.html > <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_GoldPlugin.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=rF94h73bKDdWVhxOWqRXpvw5pSMgvuHQXJ__qw8n2LU&s=PR31BXeMANGrAQP2Tt9Eg5psH82vj8Oq1WmyprGhyn8&e=> > http://llvm.org/docs/LinkTimeOptimization.html > <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_LinkTimeOptimization.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=rF94h73bKDdWVhxOWqRXpvw5pSMgvuHQXJ__qw8n2LU&s=PoqmeRXrssdG9xj6Fko_SKttwLPWqUVkxFH41dOcg4w&e=> > > > Well the primary motivation to move to LLVM is licensing which is why we > also ditched binutils since we can't package gcc for iOS due to the > GPL. So in the end the gold plugin wouldn't work for licensing reasons > even if we can get it to work technically but thanks for the links I'm > still trying to wrap my head around the problem and any info helps.The right future is a world where lld performs llvm lto for you. Until then, the technique in Gao's PDF is what I would recommend. Nick
ed at modk.it
2015-Jul-18 14:46 UTC
[LLVMdev] [Clang] [lld] [llvm-link] Whole program / dead-code optimization
Thanks Nick. I've been pursuing Gao's technique but can't seem to get opt to remove obviously dead code from even the following trivial example: int mult(int a, int b){ return a*b; } int main(void){ return 0; } While mult is never called it still is not removed. I just can't seem to get opt to understand it's seeing the whole program so it can remove this globally accessible function. What am I missing? Seems related to the missing -fwhole-program flag in clang. Perhaps this is not even possible? If I can't get any answers here I may repost that specific question since I didn't list [opt] in the original question subject. Thanks, Ed On Fri, Jul 17, 2015 at 1:15 AM, Nick Lewycky <nicholas at mxc.ca> wrote:> ed at modk.it wrote: > >> >> Is there a reason why LLVM's link-time optimization won't work for >> you? >> >> http://llvm.org/docs/GoldPlugin.html >> < >> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_GoldPlugin.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=rF94h73bKDdWVhxOWqRXpvw5pSMgvuHQXJ__qw8n2LU&s=PR31BXeMANGrAQP2Tt9Eg5psH82vj8Oq1WmyprGhyn8&e>> > >> http://llvm.org/docs/LinkTimeOptimization.html >> < >> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_LinkTimeOptimization.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=rF94h73bKDdWVhxOWqRXpvw5pSMgvuHQXJ__qw8n2LU&s=PoqmeRXrssdG9xj6Fko_SKttwLPWqUVkxFH41dOcg4w&e>> > >> >> >> Well the primary motivation to move to LLVM is licensing which is why we >> also ditched binutils since we can't package gcc for iOS due to the >> GPL. So in the end the gold plugin wouldn't work for licensing reasons >> even if we can get it to work technically but thanks for the links I'm >> still trying to wrap my head around the problem and any info helps. >> > > The right future is a world where lld performs llvm lto for you. > > Until then, the technique in Gao's PDF is what I would recommend. > > Nick >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150718/695b22de/attachment.html>