<div dir="ltr">What is the end goal? If the goal is roughly "if a user passes -O0 when compiling a TU in LTO mode, their final binary should have functions that look like the result of -O0 noLTO compilation", then the frontend can just emit a normal -O0 object file I think. What is the advantage of passing bitcode all the way to the linker only to jump through hoops to prevent LTO code generation from modifying it?<div><br></div><div><div>-- Sean Silva</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 11, 2017 at 8:34 AM, Robinson, Paul via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In D28404, Mehdi wanted to use the 'optnone' attribute as a way to record<br>
"I was compiled with -O0" in the IR, because it seems like a good idea to<br>
remember that fact in an LTO compilation and there is no way to remember<br>
that fact currently. A couple of people felt it might be better to have<br>
this idea discussed on the dev list, where it might get better exposure,<br>
so I'm volunteering to get that discussion started.<br>
<br>
While 'optnone' does cause lots of optimizations to bypass a function,<br>
exactly matching -O0 was not the motivation and never a hard requirement.<br>
The implementation makes a distinct effort to get close to the behavior<br>
of -O0, but it's not an exact match and for the intended purpose (allowing<br>
a given function to be un-optimized to help debugging) it worked fine.<br>
<br>
Using 'optnone' to convey -O0 to LTO is something of a redefinition, or<br>
at least a re-purposing, of the attribute. To get there from here, I<br>
think we would need a couple of things to happen, separately from the<br>
minor grunt work of adding 'optnone' to function IR at -O0.<br>
<br>
1) Update the LangRef definition of 'optnone' to reflect this intent.<br>
The current definition doesn't provide a motivation, and the description<br>
is (deliberately) a bit vague. If we want 'optnone' to intentionally<br>
match -O0, that should be tightened up.<br>
<br>
2) Make a concerted effort to teach 'optnone' to targets. Currently<br>
I know the X86 target is aware of it, but I'm not so sure about others.<br>
<br>
3) Take another look at what 'optnone' currently does *not* turn off,<br>
and see if there is something we can do about that. In some cases this<br>
will not be practical, and we may just have to live with that.<br>
<br>
(Okay, we need 3 things to happen.)<br>
<br>
I won't say this is blocking Mehdi's work, but it would remove a<br>
point of contention and allow the review to proceed more smoothly.<br>
--paulr<br>
<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>