<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Lang,<div><br></div><div>Either of these approaches seem fine to me. I slightly prefer actually making the symbol external, as that way if/when I run 'opt' on the new module, the function won't go missing again. If we keep the original internal linkage on the symbol, I'll end up just modifying it manually anyway. May as well have the tool do it directly.</div><div><br></div><div>-Jim</div><div><br><div><div>On Mar 3, 2013, at 5:10 PM, Lang Hames <<a href="mailto:lhames@gmail.com">lhames@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div dir="ltr">An alternative fix for this would be modifying the ExtractGV pass directly. At present it checks "hasLocalLinkage" when deciding whether to bump the linkage type. I think it should be checking isDiscardableIfUnused() instead. Alternate patch attached.<div><br></div><div>- Lang.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 3, 2013 at 4:40 PM, Lang Hames<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr">Hi All,<div><br></div><div>llvm-extract has tricked me a couple of times by handing me back an empty module when I asked it to extract a linkonce function. The problem is that when DCE tidies up the module, it strips out the function that you wanted to extract.</div><div><br></div><div>To avoid that problem, this patch sets the linkage on any function that was requested on the command line, and that would be discarded by DCE, to ExternalLinkage.</div><div><br></div><div>Given the use cases that I'm aware of for llvm-extract I think this should be an improvement. It certainly seems better than handing back an empty module. If anybody is concerned about this quietly changing the linkage type then I can improve the patch to restore the original linkage types after DCE is run.</div><div><br></div><div>Cheers,</div><div>Lang.</div></div></blockquote></div><br></div><span><make-discardable-globals-externally-visible-alternate.patch></span>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div><br></div></body></html>