<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Thanks, David. I believe at least part of the discussion you're
referring to can be found here: <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D28404">https://reviews.llvm.org/D28404</a><br>
</p>
The issue I'm running into is that after r324557 the codegen
optimization level during LTO defaults to CodeGenOpt::Default
irrespective of what they user may have specified either during the
initial compilation or during the LTO stage.<br>
<br>
This can have an impact on how the codegen pipeline is built (e.g.,
for AArch64 the SeparateConstOffsetFromGEPPass is only added to the
pipeline with CodeGenOpt::Aggressive) or it may impact they way a
function pass works (e.g., MachineBlockPlacement tail duplication is
only run with CodeGenOpt::Aggressive).<br>
<br>
I'm particularly interested in fixing the latter case, which I think
can be addressed by adding function attributes and then modifying
the codegen passes to use the function attributes rather than the
TargetPass optimization level. However, I'm open to alternative
solutions/feedback.<br>
<br>
Chad<br>
<br>
<div class="moz-cite-prefix">On 4/4/2018 10:41 AM, David Blaikie
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAENS6Ev0cTPU-BoJOdN+mhfFFj+yOnQ3omdJykGDdaBQ7J=wSg@mail.gmail.com">
<div dir="ltr"><br>
<br>
<div class="gmail_quote">
<div dir="ltr">On Tue, Apr 3, 2018 at 12:47 PM via llvm-dev
<<a href="mailto:llvm-dev@lists.llvm.org"
moz-do-not-send="true">llvm-dev@lists.llvm.org</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">All,<br>
A recent commit, D43040/r324557, changed the behavior of the
gold plugin<br>
when compiling with LTO. The change now causes the codegen
optimization<br>
level to default to CodeGenOpt::Default (i.e., -O2) rather
than use the<br>
LTO optimization level. The argument was made that the LTO
optimization<br>
level should control the amount of cross-module
optimizations done by<br>
LTO, but it should not control the codegen optimization
level; that<br>
should be based off of the optimization level used during
the initial<br>
compilation phase (i.e., bitcode generation).<br>
</blockquote>
<div><br>
At least as I recall the discussion around optnone/optsize
in the pass was that these were in some way special
semantically distinct properties (optnone being "good for
debugging" (or good for debugging compilers - what's the
baseline behavior before optimizations are applied), optsize
being "make this fit into something it wouldn't otherwise
fit into") but that the gradiations of -ON didn't fit into
this kind of model & wouldn't ever be implemented as
function attributes.<br>
<br>
CC'd Chandler & Eric who I think had opinions/were
involved in those previous discussions.<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Assuming the argument is reasonable (it make sense to me), I
was hoping<br>
to solicit feedback on how to proceed. The suggestion in
D43040/r324557<br>
was to add function attributes to represent the compile-time<br>
optimization level (which also seems reasonable to me).<br>
<br>
As a first step, I've put together two patches: 1) an llvm
patch that<br>
adds the function attributes to the LLVM IR and 2) a clang
patch that<br>
attaches these attributes to each function based on the
codegen<br>
optimization level. I then use the function level
attributes to<br>
"reconstruct" to codegen optimization level used with LTO.<br>
<br>
Please understand this is very much a WIP and just a very
small step<br>
towards a final solution.<br>
<br>
Here are the patches for reference:<br>
Clang: D45226<br>
LLVM: D45225<br>
<br>
Regards,<br>
Chad<br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank"
moz-do-not-send="true">llvm-dev@lists.llvm.org</a><br>
<a
href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote>
</div>
</div>
</blockquote>
<br>
</body>
</html>