<div dir="ltr">Hi Nico,<div><br></div><div>Sorry about that. Since I am heading out on vacation for a week tomorrow I went ahead and reverted for now. </div><div><br></div><div>Teresa</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 11, 2015 at 6:07 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Teresa,<div><br></div><div>this (well, 239480 really) seems to break building dynamic libraries pretty decisively: <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__code.google.com_p_chromium_issues_detail-3Fid-3D499508-23c3&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=z_VyneKp4ZReaPvLVXqjW1pQjAMds3wEzG2X8A5lRpY&s=rgUEjuzfVWlUt2zGUStZPkaqJLGLcYKH3QjtFYnEorQ&e=" target="_blank">https://code.google.com/p/chromium/issues/detail?id=499508#c3</a> Can you take a look, and if it takes a while to investigate, revert this for now?</div><div><br></div><div>Thanks,</div><div>Nico</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 10, 2015 at 10:49 AM, Teresa Johnson <span dir="ltr"><<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: tejohnson<br>
Date: Wed Jun 10 12:49:45 2015<br>
New Revision: 239481<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D239481-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=z_VyneKp4ZReaPvLVXqjW1pQjAMds3wEzG2X8A5lRpY&s=evjXzbq4JThRLFnriO-BOdkSfxQJiXlyacL5-pHcsMA&e=" target="_blank">http://llvm.org/viewvc/llvm-project?rev=239481&view=rev</a><br>
Log:<br>
Pass down the -flto option to the -cc1 job, and from there into the<br>
CodeGenOptions and onto the PassManagerBuilder. This enables gating<br>
the new EliminateAvailableExternally module pass on whether we are<br>
preparing for LTO.<br>
<br>
If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not<br>
included as we want to preserve available externally functions for possible<br>
link time inlining.<br>
<br>
Modified:<br>
cfe/trunk/include/clang/Driver/Options.td<br>
cfe/trunk/include/clang/Frontend/CodeGenOptions.def<br>
cfe/trunk/lib/CodeGen/BackendUtil.cpp<br>
cfe/trunk/lib/Driver/Tools.cpp<br>
cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>
cfe/trunk/test/CodeGen/available-externally-suppress.c<br>
<br>
Modified: cfe/trunk/include/clang/Driver/Options.td<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_include_clang_Driver_Options.td-3Frev-3D239481-26r1-3D239480-26r2-3D239481-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=z_VyneKp4ZReaPvLVXqjW1pQjAMds3wEzG2X8A5lRpY&s=yhk98TEtyrdelWFIZb_mAHnAUo24-wNeh8pyL1HEtIg&e=" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=239481&r1=239480&r2=239481&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Driver/Options.td (original)<br>
+++ cfe/trunk/include/clang/Driver/Options.td Wed Jun 10 12:49:45 2015<br>
@@ -636,7 +636,7 @@ def flat__namespace : Flag<["-"], "flat_<br>
def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group<f_Group>;<br>
def flimited_precision_EQ : Joined<["-"], "flimited-precision=">, Group<f_Group>;<br>
def flto_EQ : Joined<["-"], "flto=">, Group<clang_ignored_gcc_optimization_f_Group>;<br>
-def flto : Flag<["-"], "flto">, Group<f_Group>;<br>
+def flto : Flag<["-"], "flto">, Flags<[CC1Option]>, Group<f_Group>;<br>
def fno_lto : Flag<["-"], "fno-lto">, Group<f_Group>;<br>
def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">,<br>
Group<f_Group>, Flags<[DriverOption, CoreOption]>;<br>
<br>
Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_include_clang_Frontend_CodeGenOptions.def-3Frev-3D239481-26r1-3D239480-26r2-3D239481-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=z_VyneKp4ZReaPvLVXqjW1pQjAMds3wEzG2X8A5lRpY&s=RXw4kbCF3I8fOydRohU2qjjVYXRLN405AyOTHaBukVs&e=" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=239481&r1=239480&r2=239481&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)<br>
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Wed Jun 10 12:49:45 2015<br>
@@ -67,6 +67,8 @@ CODEGENOPT(InstrumentFunctions , 1, 0) /<br>
CODEGENOPT(InstrumentForProfiling , 1, 0) ///< Set when -pg is enabled.<br>
CODEGENOPT(LessPreciseFPMAD , 1, 0) ///< Enable less precise MAD instructions to<br>
///< be generated.<br>
+CODEGENOPT(PrepareForLTO , 1, 0) ///< Set when -flto is enabled on the<br>
+ ///< compile step.<br>
CODEGENOPT(MergeAllConstants , 1, 1) ///< Merge identical constants.<br>
CODEGENOPT(MergeFunctions , 1, 0) ///< Set when -fmerge-functions is enabled.<br>
CODEGENOPT(MSVolatile , 1, 0) ///< Set when /volatile:ms is enabled.<br>
<br>
Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_BackendUtil.cpp-3Frev-3D239481-26r1-3D239480-26r2-3D239481-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=z_VyneKp4ZReaPvLVXqjW1pQjAMds3wEzG2X8A5lRpY&s=lE4cTtSyoUNFFN9XWON5qb0ZLAEv1eJRFkF8_ro02zY&e=" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=239481&r1=239480&r2=239481&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed Jun 10 12:49:45 2015<br>
@@ -286,6 +286,7 @@ void EmitAssemblyHelper::CreatePasses()<br>
PMBuilder.DisableUnitAtATime = !CodeGenOpts.UnitAtATime;<br>
PMBuilder.DisableUnrollLoops = !CodeGenOpts.UnrollLoops;<br>
PMBuilder.MergeFunctions = CodeGenOpts.MergeFunctions;<br>
+ PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO;<br>
PMBuilder.RerollLoops = CodeGenOpts.RerollLoops;<br>
<br>
PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,<br>
<br>
Modified: cfe/trunk/lib/Driver/Tools.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_Driver_Tools.cpp-3Frev-3D239481-26r1-3D239480-26r2-3D239481-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=z_VyneKp4ZReaPvLVXqjW1pQjAMds3wEzG2X8A5lRpY&s=exgykA72pLavNQ0utxPMp6rlrHBNxwDVIp3AdRM010Y&e=" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=239481&r1=239480&r2=239481&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Driver/Tools.cpp (original)<br>
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Jun 10 12:49:45 2015<br>
@@ -2703,6 +2703,10 @@ void Clang::ConstructJob(Compilation &C,<br>
assert((isa<CompileJobAction>(JA) || isa<BackendJobAction>(JA)) &&<br>
"Invalid action for clang tool.");<br>
<br>
+ if (JA.getType() == types::TY_LTO_IR ||<br>
+ JA.getType() == types::TY_LTO_BC) {<br>
+ CmdArgs.push_back("-flto");<br>
+ }<br>
if (JA.getType() == types::TY_Nothing) {<br>
CmdArgs.push_back("-fsyntax-only");<br>
} else if (JA.getType() == types::TY_LLVM_IR ||<br>
<br>
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_Frontend_CompilerInvocation.cpp-3Frev-3D239481-26r1-3D239480-26r2-3D239481-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=z_VyneKp4ZReaPvLVXqjW1pQjAMds3wEzG2X8A5lRpY&s=1dvUcKCeWQ0QO_irc7TkcQuWfe9gVoAC6F4G2JX0lfc&e=" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=239481&r1=239480&r2=239481&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)<br>
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed Jun 10 12:49:45 2015<br>
@@ -485,6 +485,8 @@ static bool ParseCodeGenArgs(CodeGenOpti<br>
<br>
Opts.MergeFunctions = Args.hasArg(OPT_fmerge_functions);<br>
<br>
+ Opts.PrepareForLTO = Args.hasArg(OPT_flto);<br>
+<br>
Opts.MSVolatile = Args.hasArg(OPT_fms_volatile);<br>
<br>
Opts.VectorizeBB = Args.hasArg(OPT_vectorize_slp_aggressive);<br>
<br>
Modified: cfe/trunk/test/CodeGen/available-externally-suppress.c<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_CodeGen_available-2Dexternally-2Dsuppress.c-3Frev-3D239481-26r1-3D239480-26r2-3D239481-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=z_VyneKp4ZReaPvLVXqjW1pQjAMds3wEzG2X8A5lRpY&s=ywTSuh9Rrs5RLvTaL8rL28RMlI6M-KNiqbma3_Dd18c&e=" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/available-externally-suppress.c?rev=239481&r1=239480&r2=239481&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGen/available-externally-suppress.c (original)<br>
+++ cfe/trunk/test/CodeGen/available-externally-suppress.c Wed Jun 10 12:49:45 2015<br>
@@ -1,12 +1,18 @@<br>
// RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s<br>
+// RUN: %clang_cc1 -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s<br>
+// RUN: %clang_cc1 -flto -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s -check-prefix=LTO<br>
<br>
// Ensure that we don't emit available_externally functions at -O0.<br>
+// Also should not emit them at -O2, unless -flto is present in which case<br>
+// we should preserve them for link-time inlining decisions.<br>
int x;<br>
<br>
inline void f0(int y) { x = y; }<br>
<br>
// CHECK-LABEL: define void @test()<br>
// CHECK: declare void @f0(i32)<br>
+// LTO-LABEL: define void @test()<br>
+// LTO: define available_externally void @f0<br>
void test() {<br>
f0(17);<br>
}<br>
@@ -19,9 +25,13 @@ inline int __attribute__((always_inline)<br>
}<br>
<br>
// CHECK: @test1<br>
+// LTO: @test1<br>
int test1(int x) {<br>
// CHECK: br i1<br>
// CHECK-NOT: call {{.*}} @f1<br>
// CHECK: ret i32<br>
+ // LTO: br i1<br>
+ // LTO-NOT: call {{.*}} @f1<br>
+ // LTO: ret i32<br>
return f1(x);<br>
}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Teresa Johnson |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> 408-460-2413</td></tr></tbody></table></span></div>
</div>