@@ -424,11 +424,6 @@ class IndexBitcodeWriter : public BitcodeWriterBase {
424424 // / The combined index to write to bitcode.
425425 const ModuleSummaryIndex &Index;
426426
427- // / When writing combined summaries, provides the set of global value
428- // / summaries for which the value (function, function alias, etc) should be
429- // / imported as a declaration.
430- const GVSummaryPtrSet *DecSummaries = nullptr ;
431-
432427 // / When writing a subset of the index for distributed backends, client
433428 // / provides a map of modules to the corresponding GUIDs/summaries to write.
434429 const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex;
@@ -457,16 +452,11 @@ class IndexBitcodeWriter : public BitcodeWriterBase {
457452 // / Constructs a IndexBitcodeWriter object for the given combined index,
458453 // / writing to the provided \p Buffer. When writing a subset of the index
459454 // / for a distributed backend, provide a \p ModuleToSummariesForIndex map.
460- // / If provided, \p ModuleToDecSummaries specifies the set of summaries for
461- // / which the corresponding functions or aliased functions should be imported
462- // / as a declaration (but not definition) for each module.
463455 IndexBitcodeWriter (BitstreamWriter &Stream, StringTableBuilder &StrtabBuilder,
464456 const ModuleSummaryIndex &Index,
465- const GVSummaryPtrSet *DecSummaries = nullptr ,
466457 const std::map<std::string, GVSummaryMapTy>
467458 *ModuleToSummariesForIndex = nullptr )
468459 : BitcodeWriterBase(Stream, StrtabBuilder), Index(Index),
469- DecSummaries (DecSummaries),
470460 ModuleToSummariesForIndex (ModuleToSummariesForIndex) {
471461
472462 // See if the StackIdIndex was already added to the StackId map and
@@ -1221,8 +1211,7 @@ static uint64_t getEncodedFFlags(FunctionSummary::FFlags Flags) {
12211211
12221212// Decode the flags for GlobalValue in the summary. See getDecodedGVSummaryFlags
12231213// in BitcodeReader.cpp.
1224- static uint64_t getEncodedGVSummaryFlags (GlobalValueSummary::GVFlags Flags,
1225- bool ImportAsDecl = false ) {
1214+ static uint64_t getEncodedGVSummaryFlags (GlobalValueSummary::GVFlags Flags) {
12261215 uint64_t RawFlags = 0 ;
12271216
12281217 RawFlags |= Flags.NotEligibleToImport ; // bool
@@ -1237,8 +1226,7 @@ static uint64_t getEncodedGVSummaryFlags(GlobalValueSummary::GVFlags Flags,
12371226
12381227 RawFlags |= (Flags.Visibility << 8 ); // 2 bits
12391228
1240- unsigned ImportType = Flags.ImportType | ImportAsDecl;
1241- RawFlags |= (ImportType << 10 ); // 1 bit
1229+ RawFlags |= (Flags.ImportType << 10 ); // 1 bit
12421230
12431231 return RawFlags;
12441232}
@@ -4565,12 +4553,6 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
45654553 Abbv->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::VBR, 8 ));
45664554 unsigned AllocAbbrev = Stream.EmitAbbrev (std::move (Abbv));
45674555
4568- auto shouldImportValueAsDecl = [&](GlobalValueSummary *GVS) -> bool {
4569- if (DecSummaries == nullptr )
4570- return false ;
4571- return DecSummaries->contains (GVS);
4572- };
4573-
45744556 // The aliases are emitted as a post-pass, and will point to the value
45754557 // id of the aliasee. Save them in a vector for post-processing.
45764558 SmallVector<AliasSummary *, 64 > Aliases;
@@ -4681,8 +4663,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
46814663 NameVals.push_back (*ValueId);
46824664 assert (ModuleIdMap.count (FS->modulePath ()));
46834665 NameVals.push_back (ModuleIdMap[FS->modulePath ()]);
4684- NameVals.push_back (
4685- getEncodedGVSummaryFlags (FS->flags (), shouldImportValueAsDecl (FS)));
4666+ NameVals.push_back (getEncodedGVSummaryFlags (FS->flags ()));
46864667 NameVals.push_back (FS->instCount ());
46874668 NameVals.push_back (getEncodedFFlags (FS->fflags ()));
46884669 NameVals.push_back (FS->entryCount ());
@@ -4731,8 +4712,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
47314712 NameVals.push_back (AliasValueId);
47324713 assert (ModuleIdMap.count (AS->modulePath ()));
47334714 NameVals.push_back (ModuleIdMap[AS->modulePath ()]);
4734- NameVals.push_back (
4735- getEncodedGVSummaryFlags (AS->flags (), shouldImportValueAsDecl (AS)));
4715+ NameVals.push_back (getEncodedGVSummaryFlags (AS->flags ()));
47364716 auto AliaseeValueId = SummaryToValueIdMap[&AS->getAliasee ()];
47374717 assert (AliaseeValueId);
47384718 NameVals.push_back (AliaseeValueId);
@@ -5073,9 +5053,8 @@ void BitcodeWriter::writeModule(const Module &M,
50735053
50745054void BitcodeWriter::writeIndex (
50755055 const ModuleSummaryIndex *Index,
5076- const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex,
5077- const GVSummaryPtrSet *DecSummaries) {
5078- IndexBitcodeWriter IndexWriter (*Stream, StrtabBuilder, *Index, DecSummaries,
5056+ const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex) {
5057+ IndexBitcodeWriter IndexWriter (*Stream, StrtabBuilder, *Index,
50795058 ModuleToSummariesForIndex);
50805059 IndexWriter.write ();
50815060}
@@ -5130,13 +5109,12 @@ void IndexBitcodeWriter::write() {
51305109// index for a distributed backend, provide a \p ModuleToSummariesForIndex map.
51315110void llvm::writeIndexToFile (
51325111 const ModuleSummaryIndex &Index, raw_ostream &Out,
5133- const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex,
5134- const GVSummaryPtrSet *DecSummaries) {
5112+ const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex) {
51355113 SmallVector<char , 0 > Buffer;
51365114 Buffer.reserve (256 * 1024 );
51375115
51385116 BitcodeWriter Writer (Buffer);
5139- Writer.writeIndex (&Index, ModuleToSummariesForIndex, DecSummaries );
5117+ Writer.writeIndex (&Index, ModuleToSummariesForIndex);
51405118 Writer.writeStrtab ();
51415119
51425120 Out.write ((char *)&Buffer.front (), Buffer.size ());
0 commit comments