[llvm] r259398 - [ThinLTO] Ensure function summary output order is stable
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 1 12:25:51 PST 2016
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
More information about the llvm-commits
mailing list