[llvm] r263662 - [ProfileData] Make a utility method public, NFC

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 15:17:02 PDT 2016


On Wed, Mar 16, 2016 at 3:14 PM, Vedant Kumar <vsk at apple.com> wrote:

> Right, as long as the initializer comes from getPGOFuncName(), the IR will
> be valid.
>
> This change just lets me make the final IR swift produces look more like
> the
> IR clang produces (i.e, instrprof_increment intrinsics point to the _right_
> function name variable, instead of at some constant). It's just a cosmetic
> change but it makes the final IR less cluttered, and it makes life easier
> while
> debugging coverage issues.
>
>
OK.

David

> vedant
>
> > On Mar 16, 2016, at 2:10 PM, Xinliang David Li <xinliangli at gmail.com>
> wrote:
> >
> >
> >
> > On Wed, Mar 16, 2016 at 1:49 PM, Vedant Kumar via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> > Author: vedantk
> > Date: Wed Mar 16 15:49:26 2016
> > New Revision: 263662
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=263662&view=rev
> > Log:
> > [ProfileData] Make a utility method public, NFC
> >
> > The swift frontend needs to be able to look up PGO function name
> > variables based on the original raw function name. That's because it's
> > not possible to create PGO function name variables while emitting swift
> > IR. Instead, we have to create the name variables while lowering swift
> > IR to llvm IR, at which point we fix up all calls to the increment
> > intrinsic to point to the right name variable.
> >
> >
> > 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.
> >
> > thanks,
> >
> > David
> >
> >
> >
> > Modified:
> >     llvm/trunk/include/llvm/ProfileData/InstrProf.h
> >     llvm/trunk/lib/ProfileData/InstrProf.cpp
> >
> > Modified: llvm/trunk/include/llvm/ProfileData/InstrProf.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=263662&r1=263661&r2=263662&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/ProfileData/InstrProf.h (original)
> > +++ llvm/trunk/include/llvm/ProfileData/InstrProf.h Wed Mar 16 15:49:26
> 2016
> > @@ -165,6 +165,12 @@ std::string getPGOFuncName(StringRef Raw
> >                             StringRef FileName,
> >                             uint64_t Version = INSTR_PROF_INDEX_VERSION);
> >
> > +/// Return the name of the global variable used to store a function
> > +/// name in PGO instrumentation. \c FuncName is the name of the function
> > +/// returned by the \c getPGOFuncName call.
> > +std::string getPGOFuncNameVarName(StringRef FuncName,
> > +                                  GlobalValue::LinkageTypes Linkage);
> > +
> >  /// Create and return the global variable for function name used in PGO
> >  /// instrumentation. \c FuncName is the name of the function returned
> >  /// by \c getPGOFuncName call.
> >
> > Modified: llvm/trunk/lib/ProfileData/InstrProf.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=263662&r1=263661&r2=263662&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/ProfileData/InstrProf.cpp (original)
> > +++ llvm/trunk/lib/ProfileData/InstrProf.cpp Wed Mar 16 15:49:26 2016
> > @@ -99,8 +99,8 @@ StringRef getFuncNameWithoutPrefix(Strin
> >
> >  // \p FuncName is the string used as profile lookup key for the
> function. A
> >  // symbol is created to hold the name. Return the legalized symbol name.
> > -static std::string getPGOFuncNameVarName(StringRef FuncName,
> > -                                         GlobalValue::LinkageTypes
> Linkage) {
> > +std::string getPGOFuncNameVarName(StringRef FuncName,
> > +                                  GlobalValue::LinkageTypes Linkage) {
> >    std::string VarName = getInstrProfNameVarPrefix();
> >    VarName += FuncName;
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160316/3aa6c4ba/attachment.html>


More information about the llvm-commits mailing list