https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/107137
>From 50c021b09950cf7d6a8f25b1ac0dec246f2325f5 Mon Sep 17 00:00:00 2001 From: Amir Ayupov <aau...@fb.com> Date: Tue, 3 Sep 2024 11:38:04 -0700 Subject: [PATCH 1/3] update pseudoprobe-decoding-inline.test Created using spr 1.3.4 --- .../test/X86/pseudoprobe-decoding-inline.test | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/bolt/test/X86/pseudoprobe-decoding-inline.test b/bolt/test/X86/pseudoprobe-decoding-inline.test index 1fdd00c7ef6c4b..629dd84ab8e1dc 100644 --- a/bolt/test/X86/pseudoprobe-decoding-inline.test +++ b/bolt/test/X86/pseudoprobe-decoding-inline.test @@ -14,29 +14,38 @@ # RUN: FileCheck --input-file %t.yaml2 %s --check-prefix CHECK-YAML # CHECK-YAML: name: bar # CHECK-YAML: - bid: 0 -# CHECK-YAML: pseudo_probes: [ { guid: 0xE413754A191DB537, id: 1, type: 0 }, { guid: 0xE413754A191DB537, id: 4, type: 0 } ] -# CHECK-YAML: guid: 0xE413754A191DB537 -# CHECK-YAML: pseudo_probe_desc_hash: 0x10E852DA94 +# CHECK-YAML: pseudo_probes: +# CHECK-YAML-NEXT: - { id: 1, type: 0 +# CHECK-YAML-NEXT: - { id: 4, type: 0 +# CHECK-YAML: inline_tree: +# CHECK-YAML-NEXT: - { guid: 0xE413754A191DB537, hash: 0x10E852DA94, id: 0 } # # CHECK-YAML: name: foo # CHECK-YAML: - bid: 0 -# CHECK-YAML: pseudo_probes: [ { guid: 0x5CF8C24CDB18BDAC, id: 1, type: 0 }, { guid: 0x5CF8C24CDB18BDAC, id: 2, type: 0 } ] -# CHECK-YAML: guid: 0x5CF8C24CDB18BDAC -# CHECK-YAML: pseudo_probe_desc_hash: 0x200205A19C5B4 +# CHECK-YAML: pseudo_probes: +# CHECK-YAML-NEXT: - { id: 1, type: 0 } +# CHECK-YAML-NEXT: - { id: 2, type: 0 } +# CHECK-YAML: inline_tree: +# CHECK-YAML-NEXT: - { guid: 0x5CF8C24CDB18BDAC, hash: 0x200205A19C5B4, id: 0 } +# CHECK-YAML-NEXT: - { guid: 0xE413754A191DB537, hash: 0x10E852DA94, id: 1, callsite: 8 } # # CHECK-YAML: name: main # CHECK-YAML: - bid: 0 -# CHECK-YAML: pseudo_probes: [ { guid: 0xDB956436E78DD5FA, id: 1, type: 0 }, { guid: 0x5CF8C24CDB18BDAC, id: 1, type: 0 }, { guid: 0x5CF8C24CDB18BDAC, id: 2, type: 0 } ] -# CHECK-YAML: guid: 0xDB956436E78DD5FA -# CHECK-YAML: pseudo_probe_desc_hash: 0x10000FFFFFFFF +# CHECK-YAML: pseudo_probes: +# CHECK-YAML-NEXT: - { id: 1, type: 0 } +# CHECK-YAML-NEXT: - { id: 1, type: 0, inline_tree_id: 1 } +# CHECK-YAML-NEXT: - { id: 2, type: 0, inline_tree_id: 1 } +# CHECK-YAML: inline_tree: +# CHECK-YAML-NEXT: - { guid: 0xDB956436E78DD5FA, hash: 0x10000FFFFFFFF, id: 0 } +# CHECK-YAML-NEXT: - { guid: 0x5CF8C24CDB18BDAC, hash: 0x200205A19C5B4, id: 1, callsite: 2 } +# CHECK-YAML-NEXT: - { guid: 0xE413754A191DB537, hash: 0x10E852DA94, id: 2, parent: 1, callsite: 8 } # ## Check that without --profile-write-pseudo-probes option, no pseudo probes are ## generated # RUN: perf2bolt %S/../../../llvm/test/tools/llvm-profgen/Inputs/inline-cs-pseudoprobe.perfbin -p %t.preagg --pa -w %t.yaml -o %t.fdata # RUN: FileCheck --input-file %t.yaml %s --check-prefix CHECK-NO-OPT # CHECK-NO-OPT-NOT: pseudo_probes -# CHECK-NO-OPT-NOT: guid -# CHECK-NO-OPT-NOT: pseudo_probe_desc_hash +# CHECK-NO-OPT-NOT: inline_tree CHECK: Report of decoding input pseudo probe binaries >From 6ec4cf6bf05551d02cbf17e9edbe8d6931588ff1 Mon Sep 17 00:00:00 2001 From: Amir Ayupov <aau...@fb.com> Date: Mon, 9 Sep 2024 21:37:28 -0700 Subject: [PATCH 2/3] clang-format Created using spr 1.3.4 --- bolt/lib/Profile/YAMLProfileWriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bolt/lib/Profile/YAMLProfileWriter.cpp b/bolt/lib/Profile/YAMLProfileWriter.cpp index 70e5e09e2920e5..f2609de18ce63c 100644 --- a/bolt/lib/Profile/YAMLProfileWriter.cpp +++ b/bolt/lib/Profile/YAMLProfileWriter.cpp @@ -90,7 +90,7 @@ YAMLProfileWriter::convertPseudoProbeDesc(const MCPseudoProbeDecoder &Decoder) { InlineTreeDesc InlineTree; for (const MCDecodedPseudoProbeInlineTree &TopLev : - Decoder.getDummyInlineRoot().getChildren()) + Decoder.getDummyInlineRoot().getChildren()) InlineTree.TopLevelGUIDToInlineTree[TopLev.Guid] = &TopLev; for (const auto &FuncDesc : Decoder.getGUID2FuncDescMap()) >From 852eb07f345dd1d9e77a6faead8bf0f73ff64ba7 Mon Sep 17 00:00:00 2001 From: Amir Ayupov <aau...@fb.com> Date: Tue, 10 Sep 2024 12:26:11 -0700 Subject: [PATCH 3/3] Make pseudo_probe_desc optional Created using spr 1.3.4 --- bolt/include/bolt/Profile/ProfileYAMLMapping.h | 9 ++++++++- bolt/test/X86/pseudoprobe-decoding-inline.test | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/bolt/include/bolt/Profile/ProfileYAMLMapping.h b/bolt/include/bolt/Profile/ProfileYAMLMapping.h index 588e2f59d67e01..9cc33264d70718 100644 --- a/bolt/include/bolt/Profile/ProfileYAMLMapping.h +++ b/bolt/include/bolt/Profile/ProfileYAMLMapping.h @@ -275,6 +275,12 @@ struct PseudoProbeDesc { std::vector<Hex64> GUID; std::vector<Hex64> Hash; std::vector<uint32_t> GUIDHash; // Index of hash for that GUID in Hash + + bool operator==(const PseudoProbeDesc &Other) const { + // Only treat empty Desc as equal + return GUID.empty() && Other.GUID.empty() && Hash.empty() && + Other.Hash.empty() && GUIDHash.empty() && Other.GUIDHash.empty(); + } }; } // end namespace bolt @@ -306,7 +312,8 @@ template <> struct MappingTraits<bolt::BinaryProfile> { static void mapping(IO &YamlIO, bolt::BinaryProfile &BP) { YamlIO.mapRequired("header", BP.Header); YamlIO.mapRequired("functions", BP.Functions); - YamlIO.mapOptional("pseudo_probe_desc", BP.PseudoProbeDesc); + YamlIO.mapOptional("pseudo_probe_desc", BP.PseudoProbeDesc, + bolt::PseudoProbeDesc()); } }; diff --git a/bolt/test/X86/pseudoprobe-decoding-inline.test b/bolt/test/X86/pseudoprobe-decoding-inline.test index 0a99795d32935a..87e6fa59b07077 100644 --- a/bolt/test/X86/pseudoprobe-decoding-inline.test +++ b/bolt/test/X86/pseudoprobe-decoding-inline.test @@ -36,8 +36,9 @@ ## generated # RUN: perf2bolt %S/../../../llvm/test/tools/llvm-profgen/Inputs/inline-cs-pseudoprobe.perfbin -p %t.preagg --pa -w %t.yaml -o %t.fdata # RUN: FileCheck --input-file %t.yaml %s --check-prefix CHECK-NO-OPT -# CHECK-NO-OPT-NOT: pseudo_probes -# CHECK-NO-OPT-NOT: inline_tree +# CHECK-NO-OPT-NOT: probes: +# CHECK-NO-OPT-NOT: inline_tree: +# CHECK-NO-OPT-NOT: pseudo_probe_desc: CHECK: Report of decoding input pseudo probe binaries _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits