<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 12, 2016, at 10:13 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jan 12, 2016 at 9:59 AM, Mehdi Amini <span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Jan 12, 2016, at 8:50 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jan 12, 2016 at 8:41 AM, Mehdi Amini <span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">You need to be careful that an LTO build won’t inline and eliminate this.</div></blockquote><div class=""><br class=""></div><div class="">fair - but these calls, if they'd executed, would've been totally bogus, right? (they would've crashed/null dereferenced, etc)<br class=""><br class="">So somehow this code is live without it actually executing.<br class=""></div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">Sure it won’t execute because of the guard:   if (std::getenv("bar") != (char*) -1) return;</div><div class=""><br class=""></div><div class="">But my point was more than taking the address and not doing anything with it is not the same as calling a function, I mentioned it because I’m not sure what you had in mind to make sure the pointer always escape (printf like Tobias suggested should work).</div><span class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class="">To come back to the underlying issue: What is it we're trying to solve here? What entities are we trying to preserve & why are more traditional/normal ways of preserving them insufficient? (sorry if this is too much of a derailment/the rest  of you have enough context here, feel free to go on without me ;))</div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">What is a “more traditional/normal way of preserving” symbols? Export lists?</div></div></div></blockquote><div class=""><br class=""></div><div class="">Well, at the most basic level - if this code is needed it must be called from somewhere, why is that insufficient to ensure it is linked into the binary?<br class=""></div></div></div></div></div></blockquote><div><br class=""></div><div>OK, but that’s one level up, assuming `ForcePassLinking()` is called, now of do you make sure it includes all the other symbols we want? </div><div>There is no problem with the `llvm::createXXXXPass()` calls, but this patch was about two "more complex" symbols:</div><br class="">((llvm::Function*)nullptr)->viewCFGOnly();<br class="">((llvm::RegionPass*)nullptr)->runOnRegion((llvm::Region*)nullptr, RGM);<br class=""><br class=""><div><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class="">They require an object that you don’t have (and llvm::RegionPass has a pure virtual function so it can’t be created easily).</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div></div></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">Alternatively: What breaks if this code is removed/these things aren't preserved?</div></div></div></div></div></blockquote><div><br class=""></div><div>I don’t know for these two in particular, I guess the second one was for Polly (Tobias?).</div><div><br class=""></div><div>— </div><div>Mehdi</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><span class=""><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 12, 2016, at 8:02 AM, David Blaikie via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Do you need to call anything? Could you just take the address of the function and return it, stuff it in a global, or otherwise escape it?</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jan 12, 2016 at 12:02 AM, Dimitry Andric via llvm-commits <span dir="ltr" class=""><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">dim added a subscriber: grosser.<br class="">
<br class="">
================<br class="">
Comment at: include/llvm/LinkAllPasses.h:191<br class="">
@@ -190,3 +196,3 @@<br class="">
<span class="">       llvm::RGPassManager RGM;<br class="">
-      ((llvm::RegionPass*)nullptr)->runOnRegion((llvm::Region*)nullptr, RGM);<br class="">
</span>       llvm::AliasSetTracker X(*(llvm::AliasAnalysis*)nullptr);<br class="">
----------------<br class="">
@grosser, you originally added this part in rL117263 ("Reference RegionPass to stop it being eliminated"), do you have any suggestions? If the goal is to to unsure RegionPass.cpp is linked in, I think we can call `RegionPass::createPrinterPass()` instead.<br class="">
<div class=""><div class=""><br class="">
<br class="">
<a href="http://reviews.llvm.org/D15996" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D15996</a><br class="">
<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
llvm-commits mailing list<br class="">
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="">
</div></div></blockquote></div><br class=""></div>
_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class=""></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div></div>
</div></blockquote></span></div><br class=""></div></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>