@@ -45,8 +45,6 @@ void BoltAddressTranslation::writeEntriesForBB(MapTy &Map,
4545 LLVM_DEBUG (dbgs () << formatv (" Hash: {0:x}\n " ,
4646 getBBHash (HotFuncAddress, BBInputOffset)));
4747 (void )HotFuncAddress;
48- LLVM_DEBUG (dbgs () << formatv (" Index: {0}\n " ,
49- getBBIndex (HotFuncAddress, BBInputOffset)));
5048 // In case of conflicts (same Key mapping to different Vals), the last
5149 // update takes precedence. Of course it is not ideal to have conflicts and
5250 // those happen when we have an empty BB that either contained only
@@ -219,7 +217,6 @@ void BoltAddressTranslation::writeMaps(std::map<uint64_t, MapTy> &Maps,
219217 }
220218 size_t Index = 0 ;
221219 uint64_t InOffset = 0 ;
222- size_t PrevBBIndex = 0 ;
223220 // Output and Input addresses and delta-encoded
224221 for (std::pair<const uint32_t , uint32_t > &KeyVal : Map) {
225222 const uint64_t OutputAddress = KeyVal.first + Address;
@@ -229,15 +226,11 @@ void BoltAddressTranslation::writeMaps(std::map<uint64_t, MapTy> &Maps,
229226 encodeSLEB128 (KeyVal.second - InOffset, OS);
230227 InOffset = KeyVal.second ; // Keeping InOffset as if BRANCHENTRY is encoded
231228 if ((InOffset & BRANCHENTRY) == 0 ) {
232- unsigned BBIndex;
233- size_t BBHash;
234- std::tie (BBIndex, BBHash) = FuncHashPair.second [InOffset >> 1 ];
229+ // Basic block hash
230+ size_t BBHash = FuncHashPair.second [InOffset >> 1 ];
235231 OS.write (reinterpret_cast <char *>(&BBHash), 8 );
236- // Basic block index in the input binary
237- encodeULEB128 (BBIndex - PrevBBIndex, OS);
238- PrevBBIndex = BBIndex;
239- LLVM_DEBUG (dbgs () << formatv (" {0:x} -> {1:x} {2:x} {3}\n " , KeyVal.first ,
240- InOffset >> 1 , BBHash, BBIndex));
232+ LLVM_DEBUG (dbgs () << formatv (" {0:x} -> {1:x} {2:x}\n " , KeyVal.first ,
233+ InOffset >> 1 , BBHash));
241234 }
242235 }
243236 }
@@ -323,7 +316,6 @@ void BoltAddressTranslation::parseMaps(std::vector<uint64_t> &HotFuncs,
323316 LLVM_DEBUG (dbgs () << " Parsing " << NumEntries << " entries for 0x"
324317 << Twine::utohexstr (Address) << " \n " );
325318 uint64_t InputOffset = 0 ;
326- size_t BBIndex = 0 ;
327319 for (uint32_t J = 0 ; J < NumEntries; ++J) {
328320 const uint64_t OutputDelta = DE.getULEB128 (&Offset, &Err);
329321 const uint64_t OutputAddress = PrevAddress + OutputDelta;
@@ -338,25 +330,19 @@ void BoltAddressTranslation::parseMaps(std::vector<uint64_t> &HotFuncs,
338330 }
339331 Map.insert (std::pair<uint32_t , uint32_t >(OutputOffset, InputOffset));
340332 size_t BBHash = 0 ;
341- size_t BBIndexDelta = 0 ;
342333 const bool IsBranchEntry = InputOffset & BRANCHENTRY;
343334 if (!IsBranchEntry) {
344335 BBHash = DE.getU64 (&Offset, &Err);
345- BBIndexDelta = DE.getULEB128 (&Offset, &Err);
346- BBIndex += BBIndexDelta;
347336 // Map basic block hash to hot fragment by input offset
348- FuncHashes[HotAddress].second .emplace (InputOffset >> 1 ,
349- std::pair (BBIndex, BBHash));
337+ FuncHashes[HotAddress].second .emplace (InputOffset >> 1 , BBHash);
350338 }
351339 LLVM_DEBUG ({
352340 dbgs () << formatv (
353341 " {0:x} -> {1:x} ({2}/{3}b -> {4}/{5}b), {6:x}" , OutputOffset,
354342 InputOffset, OutputDelta, getULEB128Size (OutputDelta), InputDelta,
355343 (J < EqualElems) ? 0 : getSLEB128Size (InputDelta), OutputAddress);
356- if (!IsBranchEntry) {
357- dbgs () << formatv (" {0:x} {1}/{2}b" , BBHash, BBIndex,
358- getULEB128Size (BBIndexDelta));
359- }
344+ if (BBHash)
345+ dbgs () << formatv (" {0:x}" , BBHash);
360346 dbgs () << ' \n ' ;
361347 });
362348 }
@@ -508,19 +494,14 @@ void BoltAddressTranslation::saveMetadata(BinaryContext &BC) {
508494 FuncHashes[BF.getAddress ()].first = BF.computeHash ();
509495 BF.computeBlockHashes ();
510496 for (const BinaryBasicBlock &BB : BF)
511- FuncHashes[BF.getAddress ()].second .emplace (
512- BB. getInputOffset (), std::pair (BB. getIndex (), BB.getHash () ));
497+ FuncHashes[BF.getAddress ()].second .emplace (BB. getInputOffset (),
498+ BB.getHash ());
513499 }
514500}
515501
516- unsigned BoltAddressTranslation::getBBIndex (uint64_t FuncOutputAddress,
517- uint32_t BBInputOffset) const {
518- return FuncHashes.at (FuncOutputAddress).second .at (BBInputOffset).first ;
519- }
520-
521502size_t BoltAddressTranslation::getBBHash (uint64_t FuncOutputAddress,
522503 uint32_t BBInputOffset) const {
523- return FuncHashes.at (FuncOutputAddress).second .at (BBInputOffset). second ;
504+ return FuncHashes.at (FuncOutputAddress).second .at (BBInputOffset);
524505}
525506
526507size_t BoltAddressTranslation::getBFHash (uint64_t OutputAddress) const {
0 commit comments