<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 16, 2016 at 3:14 PM, Vedant Kumar <span dir="ltr"><<a href="mailto:vsk@apple.com" target="_blank">vsk@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Right, as long as the initializer comes from getPGOFuncName(), the IR will<br>
be valid.<br>
<br>
This change just lets me make the final IR swift produces look more like the<br>
IR clang produces (i.e, instrprof_increment intrinsics point to the _right_<br>
function name variable, instead of at some constant). It's just a cosmetic<br>
change but it makes the final IR less cluttered, and it makes life easier while<br>
debugging coverage issues.<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>OK.</div><div><br></div><div>David <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
vedant<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> On Mar 16, 2016, at 2:10 PM, Xinliang David Li <<a href="mailto:xinliangli@gmail.com">xinliangli@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> On Wed, Mar 16, 2016 at 1:49 PM, Vedant Kumar via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Author: vedantk<br>
> Date: Wed Mar 16 15:49:26 2016<br>
> New Revision: 263662<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=263662&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=263662&view=rev</a><br>
> Log:<br>
> [ProfileData] Make a utility method public, NFC<br>
><br>
> The swift frontend needs to be able to look up PGO function name<br>
> variables based on the original raw function name. That's because it's<br>
> not possible to create PGO function name variables while emitting swift<br>
> IR. Instead, we have to create the name variables while lowering swift<br>
> IR to llvm IR, at which point we fix up all calls to the increment<br>
> intrinsic to point to the right name variable.<br>
><br>
><br>
> I am not sure I understand the need of the change.  The name of the PGO name variable is purely implementation detail -- so it can be anything as long as there is no conflict. What matters is the 'content'/initializer of the name variable which is well specified.<br>
><br>
> thanks,<br>
><br>
> David<br>
><br>
><br>
><br>
> Modified:<br>
>     llvm/trunk/include/llvm/ProfileData/InstrProf.h<br>
>     llvm/trunk/lib/ProfileData/InstrProf.cpp<br>
><br>
> Modified: llvm/trunk/include/llvm/ProfileData/InstrProf.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=263662&r1=263661&r2=263662&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=263662&r1=263661&r2=263662&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/ProfileData/InstrProf.h (original)<br>
> +++ llvm/trunk/include/llvm/ProfileData/InstrProf.h Wed Mar 16 15:49:26 2016<br>
> @@ -165,6 +165,12 @@ std::string getPGOFuncName(StringRef Raw<br>
>                             StringRef FileName,<br>
>                             uint64_t Version = INSTR_PROF_INDEX_VERSION);<br>
><br>
> +/// Return the name of the global variable used to store a function<br>
> +/// name in PGO instrumentation. \c FuncName is the name of the function<br>
> +/// returned by the \c getPGOFuncName call.<br>
> +std::string getPGOFuncNameVarName(StringRef FuncName,<br>
> +                                  GlobalValue::LinkageTypes Linkage);<br>
> +<br>
>  /// Create and return the global variable for function name used in PGO<br>
>  /// instrumentation. \c FuncName is the name of the function returned<br>
>  /// by \c getPGOFuncName call.<br>
><br>
> Modified: llvm/trunk/lib/ProfileData/InstrProf.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=263662&r1=263661&r2=263662&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=263662&r1=263661&r2=263662&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/ProfileData/InstrProf.cpp (original)<br>
> +++ llvm/trunk/lib/ProfileData/InstrProf.cpp Wed Mar 16 15:49:26 2016<br>
> @@ -99,8 +99,8 @@ StringRef getFuncNameWithoutPrefix(Strin<br>
><br>
>  // \p FuncName is the string used as profile lookup key for the function. A<br>
>  // symbol is created to hold the name. Return the legalized symbol name.<br>
> -static std::string getPGOFuncNameVarName(StringRef FuncName,<br>
> -                                         GlobalValue::LinkageTypes Linkage) {<br>
> +std::string getPGOFuncNameVarName(StringRef FuncName,<br>
> +                                  GlobalValue::LinkageTypes Linkage) {<br>
>    std::string VarName = getInstrProfNameVarPrefix();<br>
>    VarName += FuncName;<br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br>
</div></div></blockquote></div><br></div></div>