@@ -424,11 +424,6 @@ class IndexBitcodeWriter : public BitcodeWriterBase {
424
424
// / The combined index to write to bitcode.
425
425
const ModuleSummaryIndex &Index;
426
426
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
-
432
427
// / When writing a subset of the index for distributed backends, client
433
428
// / provides a map of modules to the corresponding GUIDs/summaries to write.
434
429
const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex;
@@ -453,16 +448,11 @@ class IndexBitcodeWriter : public BitcodeWriterBase {
453
448
// / Constructs a IndexBitcodeWriter object for the given combined index,
454
449
// / writing to the provided \p Buffer. When writing a subset of the index
455
450
// / for a distributed backend, provide a \p ModuleToSummariesForIndex map.
456
- // / If provided, \p ModuleToDecSummaries specifies the set of summaries for
457
- // / which the corresponding functions or aliased functions should be imported
458
- // / as a declaration (but not definition) for each module.
459
451
IndexBitcodeWriter (BitstreamWriter &Stream, StringTableBuilder &StrtabBuilder,
460
452
const ModuleSummaryIndex &Index,
461
- const GVSummaryPtrSet *DecSummaries = nullptr ,
462
453
const std::map<std::string, GVSummaryMapTy>
463
454
*ModuleToSummariesForIndex = nullptr )
464
455
: BitcodeWriterBase(Stream, StrtabBuilder), Index(Index),
465
- DecSummaries (DecSummaries),
466
456
ModuleToSummariesForIndex (ModuleToSummariesForIndex) {
467
457
// Assign unique value ids to all summaries to be written, for use
468
458
// in writing out the call graph edges. Save the mapping from GUID
@@ -1208,8 +1198,7 @@ static uint64_t getEncodedFFlags(FunctionSummary::FFlags Flags) {
1208
1198
1209
1199
// Decode the flags for GlobalValue in the summary. See getDecodedGVSummaryFlags
1210
1200
// in BitcodeReader.cpp.
1211
- static uint64_t getEncodedGVSummaryFlags (GlobalValueSummary::GVFlags Flags,
1212
- bool ImportAsDecl = false ) {
1201
+ static uint64_t getEncodedGVSummaryFlags (GlobalValueSummary::GVFlags Flags) {
1213
1202
uint64_t RawFlags = 0 ;
1214
1203
1215
1204
RawFlags |= Flags.NotEligibleToImport ; // bool
@@ -1224,8 +1213,7 @@ static uint64_t getEncodedGVSummaryFlags(GlobalValueSummary::GVFlags Flags,
1224
1213
1225
1214
RawFlags |= (Flags.Visibility << 8 ); // 2 bits
1226
1215
1227
- unsigned ImportType = Flags.ImportType | ImportAsDecl;
1228
- RawFlags |= (ImportType << 10 ); // 1 bit
1216
+ RawFlags |= (Flags.ImportType << 10 ); // 1 bit
1229
1217
1230
1218
return RawFlags;
1231
1219
}
@@ -4563,12 +4551,6 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
4563
4551
Abbv->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::VBR, 8 ));
4564
4552
unsigned AllocAbbrev = Stream.EmitAbbrev (std::move (Abbv));
4565
4553
4566
- auto shouldImportValueAsDecl = [&](GlobalValueSummary *GVS) -> bool {
4567
- if (DecSummaries == nullptr )
4568
- return false ;
4569
- return DecSummaries->contains (GVS);
4570
- };
4571
-
4572
4554
// The aliases are emitted as a post-pass, and will point to the value
4573
4555
// id of the aliasee. Save them in a vector for post-processing.
4574
4556
SmallVector<AliasSummary *, 64 > Aliases;
@@ -4679,8 +4661,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
4679
4661
NameVals.push_back (*ValueId);
4680
4662
assert (ModuleIdMap.count (FS->modulePath ()));
4681
4663
NameVals.push_back (ModuleIdMap[FS->modulePath ()]);
4682
- NameVals.push_back (
4683
- getEncodedGVSummaryFlags (FS->flags (), shouldImportValueAsDecl (FS)));
4664
+ NameVals.push_back (getEncodedGVSummaryFlags (FS->flags ()));
4684
4665
NameVals.push_back (FS->instCount ());
4685
4666
NameVals.push_back (getEncodedFFlags (FS->fflags ()));
4686
4667
NameVals.push_back (FS->entryCount ());
@@ -4729,8 +4710,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
4729
4710
NameVals.push_back (AliasValueId);
4730
4711
assert (ModuleIdMap.count (AS->modulePath ()));
4731
4712
NameVals.push_back (ModuleIdMap[AS->modulePath ()]);
4732
- NameVals.push_back (
4733
- getEncodedGVSummaryFlags (AS->flags (), shouldImportValueAsDecl (AS)));
4713
+ NameVals.push_back (getEncodedGVSummaryFlags (AS->flags ()));
4734
4714
auto AliaseeValueId = SummaryToValueIdMap[&AS->getAliasee ()];
4735
4715
assert (AliaseeValueId);
4736
4716
NameVals.push_back (AliaseeValueId);
@@ -5071,9 +5051,8 @@ void BitcodeWriter::writeModule(const Module &M,
5071
5051
5072
5052
void BitcodeWriter::writeIndex (
5073
5053
const ModuleSummaryIndex *Index,
5074
- const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex,
5075
- const GVSummaryPtrSet *DecSummaries) {
5076
- IndexBitcodeWriter IndexWriter (*Stream, StrtabBuilder, *Index, DecSummaries,
5054
+ const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex) {
5055
+ IndexBitcodeWriter IndexWriter (*Stream, StrtabBuilder, *Index,
5077
5056
ModuleToSummariesForIndex);
5078
5057
IndexWriter.write ();
5079
5058
}
@@ -5127,13 +5106,12 @@ void IndexBitcodeWriter::write() {
5127
5106
// index for a distributed backend, provide a \p ModuleToSummariesForIndex map.
5128
5107
void llvm::writeIndexToFile (
5129
5108
const ModuleSummaryIndex &Index, raw_ostream &Out,
5130
- const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex,
5131
- const GVSummaryPtrSet *DecSummaries) {
5109
+ const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex) {
5132
5110
SmallVector<char , 0 > Buffer;
5133
5111
Buffer.reserve (256 * 1024 );
5134
5112
5135
5113
BitcodeWriter Writer (Buffer);
5136
- Writer.writeIndex (&Index, ModuleToSummariesForIndex, DecSummaries );
5114
+ Writer.writeIndex (&Index, ModuleToSummariesForIndex);
5137
5115
Writer.writeStrtab ();
5138
5116
5139
5117
Out.write ((char *)&Buffer.front (), Buffer.size ());
0 commit comments