[llvm] r259398 - [ThinLTO] Ensure function summary output order is stable

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 1 12:36:38 PST 2016


Will do. Not sure there is an md5sum mechanism in the regression framework,
but I can presumably modify one of my existing functions summary test cases
that uses llvm-bcanalyzer to confirm the ordering.

Teresa

On Mon, Feb 1, 2016 at 12:25 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> Thanks! Can you add a testcase?
>
> Cheers,
> Rafael
>
>
> On 1 February 2016 at 15:16, Teresa Johnson via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > Author: tejohnson
> > Date: Mon Feb  1 14:16:35 2016
> > New Revision: 259398
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=259398&view=rev
> > Log:
> > [ThinLTO] Ensure function summary output order is stable
> >
> > Iterate over the function list instead of a DenseMap of Function pointers
> > when emitting the function summary into the module.
> >
> > This fixes PR26419.
> >
> > Modified:
> >     llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
> >
> > Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=259398&r1=259397&r2=259398&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
> > +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Mon Feb  1 14:16:35
> 2016
> > @@ -2800,16 +2800,22 @@ static void WritePerModuleFunctionSummar
> >    unsigned FSAbbrev = Stream.EmitAbbrev(Abbv);
> >
> >    SmallVector<unsigned, 64> NameVals;
> > -  for (auto &I : FunctionIndex) {
> > +  // Iterate over the list of functions instead of the FunctionIndex
> map to
> > +  // ensure the ordering is stable.
> > +  for (const Function &F : *M) {
> > +    if (F.isDeclaration())
> > +      continue;
> >      // Skip anonymous functions. We will emit a function summary for
> >      // any aliases below.
> > -    if (!I.first->hasName())
> > +    if (!F.hasName())
> >        continue;
> >
> > +    assert(FunctionIndex.count(&F) == 1);
> > +
> >      WritePerModuleFunctionSummaryRecord(
> > -        NameVals, I.second->functionSummary(),
> > -
> VE.getValueID(M->getValueSymbolTable().lookup(I.first->getName())),
> > -        FSAbbrev, Stream);
> > +        NameVals, FunctionIndex[&F]->functionSummary(),
> > +        VE.getValueID(M->getValueSymbolTable().lookup(F.getName())),
> FSAbbrev,
> > +        Stream);
> >    }
> >
> >    for (const GlobalAlias &A : M->aliases()) {
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>



-- 
Teresa Johnson |  Software Engineer |  tejohnson at google.com |  408-460-2413
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160201/a8c2e611/attachment.html>


More information about the llvm-commits mailing list