diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp --- a/bolt/lib/Profile/DataAggregator.cpp +++ b/bolt/lib/Profile/DataAggregator.cpp @@ -644,14 +644,11 @@ processMemEvents(); // Mark all functions with registered events as having a valid profile. - for (auto &BFI : BC.getBinaryFunctions()) { - BinaryFunction &BF = BFI.second; - if (getBranchData(BF)) { - const auto Flags = opts::BasicAggregation ? BinaryFunction::PF_SAMPLE - : BinaryFunction::PF_LBR; + const auto Flags = opts::BasicAggregation ? BinaryFunction::PF_SAMPLE + : BinaryFunction::PF_LBR; + for (BinaryFunction &BF : llvm::make_second_range(BC.getBinaryFunctions())) + if (getBranchData(BF)) BF.markProfiled(Flags); - } - } // Release intermediate storage. clear(BranchLBRs); @@ -727,17 +724,16 @@ From -= Func.getAddress(); To -= Func.getAddress(); - LLVM_DEBUG(dbgs() << "BOLT-DEBUG: bumpBranchCount: " << Func.getPrintName() - << " @ " << Twine::utohexstr(From) << " -> " - << Func.getPrintName() << " @ " << Twine::utohexstr(To) - << '\n'); + LLVM_DEBUG(dbgs() << formatv( + "BOLT-DEBUG: bumpBranchCount: {0} @ {1:x} -> {0} @ {2:x}\n", + Func.getPrintName(), From, To)); if (BAT) { From = BAT->translate(Func.getAddress(), From, /*IsBranchSrc=*/true); To = BAT->translate(Func.getAddress(), To, /*IsBranchSrc=*/false); - LLVM_DEBUG(dbgs() << "BOLT-DEBUG: BAT translation on bumpBranchCount: " - << Func.getPrintName() << " @ " << Twine::utohexstr(From) - << " -> " << Func.getPrintName() << " @ " - << Twine::utohexstr(To) << '\n'); + LLVM_DEBUG( + dbgs() << formatv("BOLT-DEBUG: BAT translation on bumpBranchCount: {0} " + "@ {1:x} -> {0} @ {2:x}\n", + Func.getPrintName(), From, To)); } AggrData->bumpBranchCount(From, To, Count, Mispreds); @@ -1712,8 +1708,7 @@ BinaryFunction *Func = getBinaryFunctionContainingAddress(PC); if (!Func) { LLVM_DEBUG(if (PC != 0) { - dbgs() << "Skipped mem event: 0x" << Twine::utohexstr(PC) << " => 0x" - << Twine::utohexstr(Addr) << "\n"; + dbgs() << formatv("Skipped mem event: {0:x} => {1:x}\n", PC, Addr); }); continue; } @@ -2139,10 +2134,10 @@ << BinaryMMapInfo.size() << " PID(s)\n"; LLVM_DEBUG({ - for (std::pair &MMI : BinaryMMapInfo) - outs() << " " << MMI.second.PID << (MMI.second.Forked ? " (forked)" : "") - << ": (0x" << Twine::utohexstr(MMI.second.MMapAddress) << ": 0x" - << Twine::utohexstr(MMI.second.Size) << ")\n"; + for (const MMapInfo &MMI : llvm::make_second_range(BinaryMMapInfo)) + outs() << formatv(" {0}{1}: ({2:x}: {3:x})\n", MMI.PID, + (MMI.Forked ? " (forked)" : ""), MMI.MMapAddress, + MMI.Size); }); return std::error_code();