diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 95172932c56..4ee53b51f70 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -2272,7 +2272,7 @@ static void WriteValueSymbolTable( BitstreamWriter &Stream, uint64_t VSTOffsetPlaceholder = 0, uint64_t BitcodeStartBit = 0, DenseMap> - *GlobalValueIndex = nullptr) { + *FunctionIndex = nullptr) { if (VST.empty()) { // WriteValueSymbolTableForwardDecl should have returned early as // well. Ensure this handling remains in sync by asserting that @@ -2361,13 +2361,13 @@ static void WriteValueSymbolTable( // Must be the module-level VST, where we pass in the Index and // have a VSTOffsetPlaceholder. The function-level VST should not // contain any Function symbols. - assert(GlobalValueIndex); + assert(FunctionIndex); assert(VSTOffsetPlaceholder > 0); // Save the word offset of the function (from the start of the // actual bitcode written to the stream). uint64_t BitcodeIndex = - (*GlobalValueIndex)[F]->bitcodeIndex() - BitcodeStartBit; + (*FunctionIndex)[F]->bitcodeIndex() - BitcodeStartBit; assert((BitcodeIndex & 31) == 0 && "function block not 32-bit aligned"); NameVals.push_back(BitcodeIndex / 32); @@ -2529,7 +2529,7 @@ static void findRefEdges(const User *CurUser, const ValueEnumerator &VE, static void WriteFunction( const Function &F, const Module *M, ValueEnumerator &VE, BitstreamWriter &Stream, - DenseMap> &GlobalValueIndex, + DenseMap> &FunctionIndex, bool EmitSummaryIndex) { // Save the bitcode index of the start of this function block for recording // in the VST. @@ -2633,7 +2633,7 @@ static void WriteFunction( FuncSummary->addCallGraphEdges(CallGraphEdges); FuncSummary->addRefEdges(RefEdges); } - GlobalValueIndex[&F] = + FunctionIndex[&F] = llvm::make_unique(BitcodeIndex, std::move(FuncSummary)); // Emit names for all the instructions etc. @@ -2959,7 +2959,7 @@ static void WriteModuleLevelReferences(const GlobalVariable &V, /// Emit the per-module summary section alongside the rest of /// the module's bitcode. static void WritePerModuleGlobalValueSummary( - DenseMap> &GlobalValueIndex, + DenseMap> &FunctionIndex, const Module *M, const ValueEnumerator &VE, BitstreamWriter &Stream) { if (M->empty()) return; @@ -3000,7 +3000,7 @@ static void WritePerModuleGlobalValueSummary( unsigned FSModRefsAbbrev = Stream.EmitAbbrev(Abbv); SmallVector NameVals; - // Iterate over the list of functions instead of the GlobalValueIndex map to + // 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()) @@ -3010,10 +3010,10 @@ static void WritePerModuleGlobalValueSummary( if (!F.hasName()) continue; - assert(GlobalValueIndex.count(&F) == 1); + assert(FunctionIndex.count(&F) == 1); WritePerModuleFunctionSummaryRecord( - NameVals, cast(GlobalValueIndex[&F]->summary()), + NameVals, cast(FunctionIndex[&F]->summary()), VE.getValueID(M->getValueSymbolTable().lookup(F.getName())), FSCallsAbbrev, FSCallsProfileAbbrev, Stream, F); } @@ -3025,9 +3025,9 @@ static void WritePerModuleGlobalValueSummary( if (!F || F->isDeclaration()) continue; - assert(GlobalValueIndex.count(F) == 1); + assert(FunctionIndex.count(F) == 1); FunctionSummary *FS = - cast(GlobalValueIndex[F]->summary()); + cast(FunctionIndex[F]->summary()); // Add the alias to the reference list of aliasee function. FS->addRefEdge( VE.getValueID(M->getValueSymbolTable().lookup(A.getName()))); @@ -3278,18 +3278,18 @@ static void WriteModule(const Module *M, BitstreamWriter &Stream, WriteOperandBundleTags(M, Stream); // Emit function bodies. - DenseMap> GlobalValueIndex; + DenseMap> FunctionIndex; for (Module::const_iterator F = M->begin(), E = M->end(); F != E; ++F) if (!F->isDeclaration()) - WriteFunction(*F, M, VE, Stream, GlobalValueIndex, EmitSummaryIndex); + WriteFunction(*F, M, VE, Stream, FunctionIndex, EmitSummaryIndex); // Need to write after the above call to WriteFunction which populates // the summary information in the index. if (EmitSummaryIndex) - WritePerModuleGlobalValueSummary(GlobalValueIndex, M, VE, Stream); + WritePerModuleGlobalValueSummary(FunctionIndex, M, VE, Stream); WriteValueSymbolTable(M->getValueSymbolTable(), VE, Stream, - VSTOffsetPlaceholder, BitcodeStartBit, &GlobalValueIndex); + VSTOffsetPlaceholder, BitcodeStartBit, &FunctionIndex); if (GenerateHash) { writeModuleHash(Stream, Buffer, BlockStartPos);