<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="">Another way is to have a cl::opt, possibly defaulted to enable in debug build.<div class="">The test would enable it unconditionally and would pass both in assert and release builds.</div><div class=""><br class=""></div><div class="">— </div><div class="">Mehdi</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 6, 2016, at 4:25 PM, Teresa Johnson <<a href="mailto:tejohnson@google.com" class="">tejohnson@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Add:<div class=""><div class="">; REQUIRES: asserts</div></div><div class=""><br class=""></div><div class="">to the test. Which probably means that this would be better off tested via a new test.</div><div class=""><br class=""></div><div class="">Teresa</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Jul 6, 2016 at 4:15 PM, Piotr Padlewski <span dir="ltr" class=""><<a href="mailto:prazek@google.com" target="_blank" class="">prazek@google.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 dir="ltr" class="">How should I test that? So after adding this defines, tests will fail on non debug build or non statistics</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Jul 6, 2016 at 3:52 PM, Piotr Padlewski <span dir="ltr" class=""><<a href="mailto:prazek@google.com" target="_blank" class="">prazek@google.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 dir="ltr" class="">Good point, I will fix it in a minute<div class=""><br class=""></div></div><div class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Jul 6, 2016 at 2:01 PM, Teresa Johnson 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"><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote"><span class="">On Wed, Jul 6, 2016 at 1:45 PM, Mehdi Amini 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class=""><br class="">
> On Jul 6, 2016, at 1:26 PM, Piotr Padlewski via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a>> wrote:<br class="">
><br class="">
> Author: prazek<br class="">
> Date: Wed Jul  6 15:26:25 2016<br class="">
> New Revision: 274668<br class="">
><br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=274668&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=274668&view=rev</a><br class="">
> Log:<br class="">
> Add 'thinlto_src_module' metadata to imported function<br class="">
><br class="">
> Added metadata to be able to make statistics on how many functions<br class="">
> that have been imported have been removed. Also module name might<br class="">
> be helpfull when debugging.<br class="">
<br class="">
<br class="">
</span>It is not clear to me why this is enabled in production build, or not covered under a debugging flag.<br class=""></blockquote><div class=""><br class=""></div></span><div class="">Good point. Since this is initially designed to drive some statistics, perhaps enabling it for non-release builds similar to when --stats is enabled (see ADT/Statistic.h: #if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)).<br class=""><br class="">Teresa</div><div class=""><span style="font-size: inherit; font-family: monospace; line-height: 16.25px; white-space: pre-wrap;" class=""><br class=""></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
—<div class=""><div class=""><br class="">
Mehdi<br class="">
<div class=""><div class=""><br class="">
<br class="">
<br class="">
<br class="">
<br class="">
><br class="">
> Reviewers: tejohnson, eraman<br class="">
><br class="">
> Subscribers: mehdi_amini, llvm-commits<br class="">
><br class="">
> Differential Revision: <a href="http://reviews.llvm.org/D21943" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D21943</a><br class="">
><br class="">
> Modified:<br class="">
>    llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp<br class="">
>    llvm/trunk/test/Transforms/FunctionImport/funcimport.ll<br class="">
><br class="">
> Modified: llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp<br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp?rev=274668&r1=274667&r2=274668&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp?rev=274668&r1=274667&r2=274668&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp (original)<br class="">
> +++ llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp Wed Jul  6 15:26:25 2016<br class="">
> @@ -591,6 +591,12 @@ bool FunctionImporter::importFunctions(<br class="">
>                    << SrcModule->getSourceFileName() << "\n");<br class="">
>       if (Import) {<br class="">
>         F.materialize();<br class="">
> +        // Add 'thinlto_src_module' metadata for statistics and debugging.<br class="">
> +        F.setMetadata("thinlto_src_module",<br class="">
> +                      llvm::MDNode::get(DestModule.getContext(),<br class="">
> +                                        {llvm::MDString::get(<br class="">
> +                                            DestModule.getContext(),<br class="">
> +                                            SrcModule->getSourceFileName())}));<br class="">
>         GlobalsToImport.insert(&F);<br class="">
>       }<br class="">
>     }<br class="">
><br class="">
> Modified: llvm/trunk/test/Transforms/FunctionImport/funcimport.ll<br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/FunctionImport/funcimport.ll?rev=274668&r1=274667&r2=274668&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/FunctionImport/funcimport.ll?rev=274668&r1=274667&r2=274668&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- llvm/trunk/test/Transforms/FunctionImport/funcimport.ll (original)<br class="">
> +++ llvm/trunk/test/Transforms/FunctionImport/funcimport.ll Wed Jul  6 15:26:25 2016<br class="">
> @@ -14,7 +14,7 @@<br class="">
><br class="">
> ; Test import with smaller instruction limit and without the -disable-force-link-odr<br class="">
> ; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=5 -S | FileCheck %s --check-prefix=INSTLIM5ODR<br class="">
> -; INSTLIM5ODR: define linkonce_odr void @linkonceodr()<br class="">
> +; INSTLIM5ODR: define linkonce_odr void @linkonceodr() {<br class="">
><br class="">
><br class="">
> define i32 @main() #0 {<br class="">
> @@ -47,7 +47,7 @@ declare void @analias(...) #1<br class="">
> declare void @linkoncealias(...) #1<br class="">
><br class="">
> ; INSTLIMDEF-DAG: Import referencestatics<br class="">
> -; INSTLIMDEF-DAG: define available_externally i32 @referencestatics(i32 %i)<br class="">
> +; INSTLIMDEF-DAG: define available_externally i32 @referencestatics(i32 %i) !thinlto_src_module !0 {<br class="">
> ; INSTLIM5-DAG: declare i32 @referencestatics(...)<br class="">
> declare i32 @referencestatics(...) #1<br class="">
><br class="">
> @@ -56,27 +56,27 @@ declare i32 @referencestatics(...) #1<br class="">
> ; Ensure that the call is to the properly-renamed function.<br class="">
> ; INSTLIMDEF-DAG: Import staticfunc<br class="">
> ; INSTLIMDEF-DAG: %call = call i32 @staticfunc.llvm.<br class="">
> -; INSTLIMDEF-DAG: define available_externally hidden i32 @staticfunc.llvm.<br class="">
> +; INSTLIMDEF-DAG: define available_externally hidden i32 @staticfunc.llvm.{{.*}} !thinlto_src_module !0 {<br class="">
><br class="">
> ; INSTLIMDEF-DAG: Import referenceglobals<br class="">
> -; CHECK-DAG: define available_externally i32 @referenceglobals(i32 %i)<br class="">
> +; CHECK-DAG: define available_externally i32 @referenceglobals(i32 %i) !thinlto_src_module !0 {<br class="">
> declare i32 @referenceglobals(...) #1<br class="">
><br class="">
> ; The import of referenceglobals will expose call to globalfunc1 that<br class="">
> ; should in turn be imported.<br class="">
> ; INSTLIMDEF-DAG: Import globalfunc1<br class="">
> -; CHECK-DAG: define available_externally void @globalfunc1()<br class="">
> +; CHECK-DAG: define available_externally void @globalfunc1() !thinlto_src_module !0<br class="">
><br class="">
> ; INSTLIMDEF-DAG: Import referencecommon<br class="">
> -; CHECK-DAG: define available_externally i32 @referencecommon(i32 %i)<br class="">
> +; CHECK-DAG: define available_externally i32 @referencecommon(i32 %i) !thinlto_src_module !0 {<br class="">
> declare i32 @referencecommon(...) #1<br class="">
><br class="">
> ; INSTLIMDEF-DAG: Import setfuncptr<br class="">
> -; CHECK-DAG: define available_externally void @setfuncptr()<br class="">
> +; CHECK-DAG: define available_externally void @setfuncptr() !thinlto_src_module !0 {<br class="">
> declare void @setfuncptr(...) #1<br class="">
><br class="">
> ; INSTLIMDEF-DAG: Import callfuncptr<br class="">
> -; CHECK-DAG: define available_externally void @callfuncptr()<br class="">
> +; CHECK-DAG: define available_externally void @callfuncptr() !thinlto_src_module !0 {<br class="">
> declare void @callfuncptr(...) #1<br class="">
><br class="">
> ; Ensure that all uses of local variable @P which has used in setfuncptr<br class="">
> @@ -87,7 +87,7 @@ declare void @callfuncptr(...) #1<br class="">
><br class="">
> ; Ensure that @referencelargelinkonce definition is pulled in, but later we<br class="">
> ; also check that the linkonceodr function is not.<br class="">
> -; CHECK-DAG: define available_externally void @referencelargelinkonce()<br class="">
> +; CHECK-DAG: define available_externally void @referencelargelinkonce() !thinlto_src_module !0 {<br class="">
> ; INSTLIM5-DAG: declare void @linkonceodr()<br class="">
> declare void @referencelargelinkonce(...)<br class="">
><br class="">
> @@ -100,11 +100,12 @@ declare void @weakfunc(...) #1<br class="">
> declare void @linkoncefunc2(...) #1<br class="">
><br class="">
> ; INSTLIMDEF-DAG: Import funcwithpersonality<br class="">
> -; INSTLIMDEF-DAG: define available_externally hidden void @funcwithpersonality.llvm.{{.*}}() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {<br class="">
> +; INSTLIMDEF-DAG: define available_externally hidden void @funcwithpersonality.llvm.{{.*}}() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) !thinlto_src_module !0 {<br class="">
> ; INSTLIM5-DAG: declare hidden void @funcwithpersonality.llvm.{{.*}}()<br class="">
><br class="">
> ; INSTLIMDEF-DAG: Import globalfunc2<br class="">
> ; INSTLIMDEF-DAG: 13 function-import - Number of functions imported<br class="">
> +; CHECK-DAG: !0 = !{!"{{.*}}/Inputs/funcimport.ll"}<br class="">
><br class="">
> ; The actual GUID values will depend on path to test.<br class="">
> ; GUID-DAG: GUID {{.*}} is weakalias<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="">
<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></div></div></blockquote></div><span class=""><font color="#888888" class=""><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class=""><span style="font-family: times; font-size: inherit;" class=""><table cellspacing="0" cellpadding="0" class=""><tbody class=""><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small" class=""><td nowrap="" style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px" class="">Teresa Johnson |</td><td nowrap="" style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px" class=""> Software Engineer |</td><td nowrap="" style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px" class=""> <a href="mailto:tejohnson@google.com" target="_blank" class="">tejohnson@google.com</a> |</td><td nowrap="" style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px" class=""> <a href="tel:408-460-2413" value="+14084602413" target="_blank" class="">408-460-2413</a></td></tr></tbody></table></span></div>
</font></span></div></div>
<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="">
<br class=""></blockquote></div><br class=""></div>
</div></div></blockquote></div><br class=""></div>
</div></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature" data-smartmail="gmail_signature"><span style="font-family: Times; font-size: inherit;" class=""><table cellspacing="0" cellpadding="0" class=""><tbody class=""><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small" class=""><td nowrap="" style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px" class="">Teresa Johnson |</td><td nowrap="" style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px" class=""> Software Engineer |</td><td nowrap="" style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px" class=""> <a href="mailto:tejohnson@google.com" target="_blank" class="">tejohnson@google.com</a> |</td><td nowrap="" style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px" class=""> 408-460-2413</td></tr></tbody></table></span></div>
</div>
</div></blockquote></div><br class=""></div></body></html>