@@ -4299,9 +4299,20 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() {
42994299 return ;
43004300 }
43014301
4302+ auto Abbv = std::make_shared<BitCodeAbbrev>();
4303+ Abbv->Add (BitCodeAbbrevOp (bitc::FS_VALUE_GUID));
4304+ Abbv->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::VBR, 6 ));
4305+ // GUIDS often use up most of 64-bits, so encode as two Fixed 32.
4306+ Abbv->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed, 32 ));
4307+ Abbv->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed, 32 ));
4308+ unsigned ValueGuidAbbrev = Stream.EmitAbbrev (std::move (Abbv));
4309+
43024310 for (const auto &GVI : valueIds ()) {
43034311 Stream.EmitRecord (bitc::FS_VALUE_GUID,
4304- ArrayRef<uint64_t >{GVI.second , GVI.first });
4312+ ArrayRef<uint32_t >{GVI.second ,
4313+ static_cast <uint32_t >(GVI.first >> 32 ),
4314+ static_cast <uint32_t >(GVI.first )},
4315+ ValueGuidAbbrev);
43054316 }
43064317
43074318 if (!Index->stackIds ().empty ()) {
@@ -4315,7 +4326,7 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() {
43154326 }
43164327
43174328 // Abbrev for FS_PERMODULE_PROFILE.
4318- auto Abbv = std::make_shared<BitCodeAbbrev>();
4329+ Abbv = std::make_shared<BitCodeAbbrev>();
43194330 Abbv->Add (BitCodeAbbrevOp (bitc::FS_PERMODULE_PROFILE));
43204331 Abbv->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::VBR, 8 )); // valueid
43214332 Abbv->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::VBR, 8 )); // flags
@@ -4467,9 +4478,20 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
44674478 // Write the index flags.
44684479 Stream.EmitRecord (bitc::FS_FLAGS, ArrayRef<uint64_t >{Index.getFlags ()});
44694480
4481+ auto Abbv = std::make_shared<BitCodeAbbrev>();
4482+ Abbv->Add (BitCodeAbbrevOp (bitc::FS_VALUE_GUID));
4483+ Abbv->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::VBR, 6 ));
4484+ // GUIDS often use up most of 64-bits, so encode as two Fixed 32.
4485+ Abbv->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed, 32 ));
4486+ Abbv->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed, 32 ));
4487+ unsigned ValueGuidAbbrev = Stream.EmitAbbrev (std::move (Abbv));
4488+
44704489 for (const auto &GVI : valueIds ()) {
44714490 Stream.EmitRecord (bitc::FS_VALUE_GUID,
4472- ArrayRef<uint64_t >{GVI.second , GVI.first });
4491+ ArrayRef<uint32_t >{GVI.second ,
4492+ static_cast <uint32_t >(GVI.first >> 32 ),
4493+ static_cast <uint32_t >(GVI.first )},
4494+ ValueGuidAbbrev);
44734495 }
44744496
44754497 if (!StackIdIndices.empty ()) {
@@ -4488,7 +4510,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
44884510 }
44894511
44904512 // Abbrev for FS_COMBINED_PROFILE.
4491- auto Abbv = std::make_shared<BitCodeAbbrev>();
4513+ Abbv = std::make_shared<BitCodeAbbrev>();
44924514 Abbv->Add (BitCodeAbbrevOp (bitc::FS_COMBINED_PROFILE));
44934515 Abbv->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::VBR, 8 )); // valueid
44944516 Abbv->Add (BitCodeAbbrevOp (BitCodeAbbrevOp::VBR, 8 )); // modid
0 commit comments