From 5f357959a5156687314e83c86280e2bff20e0dc5 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Fri, 20 Jun 2025 17:07:36 -0700 Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?= =?UTF-8?q?l=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.4 --- bolt/lib/Profile/DataAggregator.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp index 5c8af3710720d..07d706c926a42 100644 --- a/bolt/lib/Profile/DataAggregator.cpp +++ b/bolt/lib/Profile/DataAggregator.cpp @@ -2279,12 +2279,11 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC, const BoltAddressTranslation::BBHashMapTy &BlockMap = BAT->getBBHashMap(FuncAddress); YamlBF.Blocks.resize(YamlBF.NumBasicBlocks); + for (size_t Idx = 0; Idx != YamlBF.NumBasicBlocks; ++Idx) + YamlBF.Blocks[Idx].Index = Idx; - for (auto &&[Entry, YamlBB] : llvm::zip(BlockMap, YamlBF.Blocks)) { - const auto &Block = Entry.second; - YamlBB.Hash = Block.Hash; - YamlBB.Index = Block.Index; - } + for (const auto &Block : llvm::make_second_range(BlockMap)) + YamlBF.Blocks[Block.Index].Hash = Block.Hash; // Lookup containing basic block offset and index auto getBlock = [&BlockMap](uint32_t Offset) {