llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-pgo Author: Vitaly Buka (vitalybuka) <details> <summary>Changes</summary> Pre-commit unit test coverage for `FunctionSamples::getCanonicalFnName` with combined `.cfi`, `.llvm.`, `.part.`, and `.__uniq.` suffixes and for `InstrProfSymtab::getCanonicalName`. CC: @<!-- -->benschlueter Assisted-by: Gemini --- Full diff: https://github.com/llvm/llvm-project/pull/240697.diff 2 Files Affected: - (modified) llvm/unittests/ProfileData/InstrProfTest.cpp (+11) - (modified) llvm/unittests/ProfileData/SampleProfTest.cpp (+13-1) ``````````diff diff --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp index 0c09467169abe3..a7fe530c607648 100644 --- a/llvm/unittests/ProfileData/InstrProfTest.cpp +++ b/llvm/unittests/ProfileData/InstrProfTest.cpp @@ -811,6 +811,17 @@ TEST_F(InstrProfTest, test_symtab_lookup_vtable_with_assigned_guid) { GV); } +TEST_F(InstrProfTest, test_symtab_get_canonical_name) { + EXPECT_EQ(InstrProfSymtab::getCanonicalName("foo.llvm.1234"), "foo"); + EXPECT_EQ(InstrProfSymtab::getCanonicalName("foo.part.1"), "foo"); + EXPECT_EQ( + InstrProfSymtab::getCanonicalName("foo.__uniq.123.part.1.llvm.9999"), + "foo.__uniq.123"); + // Coroutine clone suffixes are preserved. + EXPECT_EQ(InstrProfSymtab::getCanonicalName("coro.llvm.1234.resume"), + "coro.llvm.1234.resume"); +} + // callee1 to callee6 are from vtable1 to vtable6 respectively. static const char callee1[] = "callee1"; static const char callee2[] = "callee2"; diff --git a/llvm/unittests/ProfileData/SampleProfTest.cpp b/llvm/unittests/ProfileData/SampleProfTest.cpp index a991333ef2bcf3..6dd7b701dec5f0 100644 --- a/llvm/unittests/ProfileData/SampleProfTest.cpp +++ b/llvm/unittests/ProfileData/SampleProfTest.cpp @@ -1236,8 +1236,14 @@ TEST(SampleProfCanonicalNameTest, SelectedPolicyDefault) { EXPECT_EQ("foo.part.1.bar", FunctionSamples::getCanonicalFnName("foo.part.1.bar")); - // Combined suffixes in canonical order. + // Combined suffixes in canonical order (including split-LTO 32-hex module ID + // promotion and CFI .cfi suffix). EXPECT_EQ("foo", FunctionSamples::getCanonicalFnName("foo.part.1.llvm.456")); + EXPECT_EQ("foo", FunctionSamples::getCanonicalFnName("foo.cfi")); + EXPECT_EQ("foo", FunctionSamples::getCanonicalFnName( + "foo.llvm.13757e0fb71915e385efa4dc9d1e08fd.cfi")); + EXPECT_EQ("foo", FunctionSamples::getCanonicalFnName( + "foo.part.1.llvm.13757e0fb71915e385efa4dc9d1e08fd.cfi")); // Suffixes in non-canonical order: .llvm. cannot be stripped if .part. // follows it, but .part. can be stripped leaving .llvm. @@ -1260,6 +1266,9 @@ TEST(SampleProfCanonicalNameTest, SelectedPolicyHasUniqSuffix) { FunctionSamples::getCanonicalFnName("foo.__uniq.123.part.1")); EXPECT_EQ("foo", FunctionSamples::getCanonicalFnName( "foo.__uniq.123.part.1.llvm.456")); + EXPECT_EQ("foo", + FunctionSamples::getCanonicalFnName( + "foo.__uniq.123.llvm.13757e0fb71915e385efa4dc9d1e08fd.cfi")); EXPECT_EQ("foo", FunctionSamples::getCanonicalFnName("foo.llvm.456")); EXPECT_EQ("foo", FunctionSamples::getCanonicalFnName("foo.part.1")); } @@ -1275,6 +1284,9 @@ TEST(SampleProfCanonicalNameTest, SelectedPolicyHasUniqSuffix) { FunctionSamples::getCanonicalFnName("foo.__uniq.123.part.1")); EXPECT_EQ("foo.__uniq.123", FunctionSamples::getCanonicalFnName( "foo.__uniq.123.part.1.llvm.456")); + EXPECT_EQ("foo.__uniq.123", + FunctionSamples::getCanonicalFnName( + "foo.__uniq.123.llvm.13757e0fb71915e385efa4dc9d1e08fd.cfi")); EXPECT_EQ("foo", FunctionSamples::getCanonicalFnName("foo.llvm.456")); EXPECT_EQ("foo", FunctionSamples::getCanonicalFnName("foo.part.1")); } `````````` </details> https://github.com/llvm/llvm-project/pull/240697 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
