================
@@ -2421,11 +2433,14 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
             const uint32_t InputOffset = BAT->translate(
                 FuncAddr, OutputAddress - FuncAddr, /*IsBranchSrc=*/true);
             const unsigned BlockIndex = getBlock(InputOffset).second;
-            YamlBF.Blocks[BlockIndex].PseudoProbes.emplace_back(
-                yaml::bolt::PseudoProbeInfo{Probe.getGuid(), Probe.getIndex(),
-                                            Probe.getType()});
+            BlockProbes[BlockIndex].emplace_back(Probe);
           }
         }
+
+        for (auto &[Block, Probes] : BlockProbes) {
+          YamlBF.Blocks[Block].PseudoProbes =
+              YAMLProfileWriter::writeBlockProbes(Probes, InlineTreeNodeId);
----------------
aaupov wrote:

We have two places where YAML function profile is constructed: 
- YAMLProfileWriter for the regular case: the profile is dumped from function 
CFG, 
- DataAggregator for BOLTed binaries/functions where we want the profile for 
the original function: the profile is reconstructed using 
[BAT](https://github.com/llvm/llvm-project/blob/8168088f0a9015bc6d930e8bc1c639dee06ca82c/bolt/docs/BAT.md)
 (BOLT Address Translation) tables.

In DataAggregator/BAT case we want to write profile for original/pre-BOLT 
binary including probe information, and there's no explicit way to iterate over 
probes in original/pre-BOLT order while they're encoded in optimized/BOLTed 
order.

https://github.com/llvm/llvm-project/pull/107137
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to