<div dir="ltr">Hey all,<div><br></div><div>I'm working on adding interprocedural FunctionAttrs optimization (<a href="http://llvm-cs.pcc.me.uk/lib/Transforms/IPO/FunctionAttrs.cpp">http://llvm-cs.pcc.me.uk/lib/Transforms/IPO/FunctionAttrs.cpp</a>) to ThinLTO so it does something similar to what LTO is doing (<a href="https://bugs.llvm.org/show_bug.cgi?id=33648">https://bugs.llvm.org/show_bug.cgi?id=33648</a>). I've hit a problem with how the FunctionAttrs optimization expects linkage types.</div><div><br></div><div><span style="font-size:12.8px">In ThinLTO since the linkage type is set to External or AvailableExternally it is unable to apply any of the functionattr optimizations that LTO can (since LTO is able to convert everything to Internal). This is a problem because every functionattr optimization expects an exact definition by calling hasExactDefinition (</span><a href="http://llvm-cs.pcc.me.uk/include/llvm/IR/GlobalValue.h#387" target="_blank" style="font-size:12.8px">http://llvm-cs.pcc.me.uk/<wbr>include/llvm/IR/GlobalValue.h#<wbr>387</a><span style="font-size:12.8px">) which doesn't want a derefined function (mayBeDerefined </span><a href="http://llvm-cs.pcc.me.uk/include/llvm/IR/GlobalValue.h#119" target="_blank" style="font-size:12.8px">http://llvm-cs.pcc.me.uk/<wbr>include/llvm/IR/GlobalValue.h#<wbr>119</a><span style="font-size:12.8px">). According to the current definition, an AvailableExternally function could be derefined so hasExactDefinition fails.</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Does anyone have any ideas on how to make a function with External/AvailableExternally linkage type have an exact definition?</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thanks,</span></div><div><span style="font-size:12.8px">Charles</span></div></div>