@@ -428,9 +428,10 @@ class IndexBitcodeWriter : public BitcodeWriterBase {
428
428
// / The combined index to write to bitcode.
429
429
const ModuleSummaryIndex &Index;
430
430
431
- // / For each module, provides the set of global value summaries for which the
432
- // / value (function, function alias, etc) should be imported as a declaration.
433
- const ModuleToGVSummaryPtrSet *ModuleToDecSummaries = nullptr ;
431
+ // / When writing combined summaries, provides the set of global value
432
+ // / summaries for which the value (function, function alias, etc) should be
433
+ // / imported as a declaration.
434
+ const GVSummaryPtrSet *DecSummaries = nullptr ;
434
435
435
436
// / When writing a subset of the index for distributed backends, client
436
437
// / provides a map of modules to the corresponding GUIDs/summaries to write.
@@ -459,14 +460,13 @@ class IndexBitcodeWriter : public BitcodeWriterBase {
459
460
// / If provided, \p ModuleToDecSummaries specifies the set of summaries for
460
461
// / which the corresponding functions or aliased functions should be imported
461
462
// / as a declaration (but not definition) for each module.
462
- IndexBitcodeWriter (
463
- BitstreamWriter &Stream, StringTableBuilder &StrtabBuilder,
464
- const ModuleSummaryIndex &Index,
465
- const ModuleToGVSummaryPtrSet *ModuleToDecSummaries = nullptr ,
466
- const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex =
467
- nullptr )
463
+ IndexBitcodeWriter (BitstreamWriter &Stream, StringTableBuilder &StrtabBuilder,
464
+ const ModuleSummaryIndex &Index,
465
+ const GVSummaryPtrSet *DecSummaries = nullptr ,
466
+ const std::map<std::string, GVSummaryMapTy>
467
+ *ModuleToSummariesForIndex = nullptr )
468
468
: BitcodeWriterBase(Stream, StrtabBuilder), Index(Index),
469
- ModuleToDecSummaries (ModuleToDecSummaries ),
469
+ DecSummaries (DecSummaries ),
470
470
ModuleToSummariesForIndex(ModuleToSummariesForIndex) {
471
471
// Assign unique value ids to all summaries to be written, for use
472
472
// in writing out the call graph edges. Save the mapping from GUID
@@ -4556,14 +4556,9 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
4556
4556
unsigned AllocAbbrev = Stream.EmitAbbrev (std::move (Abbv));
4557
4557
4558
4558
auto shouldImportValueAsDecl = [&](GlobalValueSummary *GVS) -> bool {
4559
- if (ModuleToDecSummaries == nullptr )
4559
+ if (DecSummaries == nullptr )
4560
4560
return false ;
4561
- auto Iter = ModuleToDecSummaries->find (GVS->modulePath ().str ());
4562
- if (Iter == ModuleToDecSummaries->end ())
4563
- return false ;
4564
- // For the current module, the value for GVS should be imported as a
4565
- // declaration.
4566
- return Iter->second .contains (GVS);
4561
+ return DecSummaries->contains (GVS);
4567
4562
};
4568
4563
4569
4564
// The aliases are emitted as a post-pass, and will point to the value
@@ -5062,9 +5057,8 @@ void BitcodeWriter::writeModule(const Module &M,
5062
5057
void BitcodeWriter::writeIndex (
5063
5058
const ModuleSummaryIndex *Index,
5064
5059
const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex,
5065
- const ModuleToGVSummaryPtrSet *ModuleToDecSummaries) {
5066
- IndexBitcodeWriter IndexWriter (*Stream, StrtabBuilder, *Index,
5067
- ModuleToDecSummaries,
5060
+ const GVSummaryPtrSet *DecSummaries) {
5061
+ IndexBitcodeWriter IndexWriter (*Stream, StrtabBuilder, *Index, DecSummaries,
5068
5062
ModuleToSummariesForIndex);
5069
5063
IndexWriter.write ();
5070
5064
}
@@ -5118,12 +5112,12 @@ void IndexBitcodeWriter::write() {
5118
5112
void llvm::writeIndexToFile (
5119
5113
const ModuleSummaryIndex &Index, raw_ostream &Out,
5120
5114
const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex,
5121
- const ModuleToGVSummaryPtrSet *ModuleToDecSummaries ) {
5115
+ const GVSummaryPtrSet *DecSummaries ) {
5122
5116
SmallVector<char , 0 > Buffer;
5123
5117
Buffer.reserve (256 * 1024 );
5124
5118
5125
5119
BitcodeWriter Writer (Buffer);
5126
- Writer.writeIndex (&Index, ModuleToSummariesForIndex, ModuleToDecSummaries );
5120
+ Writer.writeIndex (&Index, ModuleToSummariesForIndex, DecSummaries );
5127
5121
Writer.writeStrtab ();
5128
5122
5129
5123
Out.write ((char *)&Buffer.front (), Buffer.size ());
0 commit comments