diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h index d15b96db58fef..4d471fd1239d6 100644 --- a/llvm/include/llvm/ProfileData/SampleProf.h +++ b/llvm/include/llvm/ProfileData/SampleProf.h @@ -1027,6 +1027,21 @@ class FunctionSamples { return VirtualCallsiteTypeCounts[mapIRLocToProfileLoc(Loc)]; } + /// At location \p Loc, add a type sample for the given \p Type with + /// \p Count. This function uses saturating add which clamp the result to + /// maximum uint64_t (the counter type), and inserts the saturating add result + /// to map. Returns counter_overflow to caller if the actual result is larger + /// than maximum uint64_t. + sampleprof_error addTypeSamplesAt(const LineLocation &Loc, FunctionId Type, + uint64_t Count) { + auto &TypeCounts = getTypeSamplesAt(Loc); + bool Overflowed = false; + TypeCounts[Type] = SaturatingMultiplyAdd(Count, /* Weight= */ (uint64_t)1, + TypeCounts[Type], &Overflowed); + return Overflowed ? sampleprof_error::counter_overflow + : sampleprof_error::success; + } + /// Scale \p Other sample counts by \p Weight and add the scaled result to the /// type samples for the undrifted location of \p Loc. template diff --git a/llvm/test/tools/llvm-profgen/Inputs/dap-perf-trace.txt b/llvm/test/tools/llvm-profgen/Inputs/dap-perf-trace.txt new file mode 100644 index 0000000000000..04025c79fa9a2 --- /dev/null +++ b/llvm/test/tools/llvm-profgen/Inputs/dap-perf-trace.txt @@ -0,0 +1,37 @@ +0 0x7b10 [0x88]: PERF_RECORD_MMAP2 3446532/3446532: [0x200000(0x60000) @ 0 08:01 527501 0]: r--p /path/to/dap.bin +0 0x7b98 [0x88]: PERF_RECORD_MMAP2 3446532/3446532: [0x260000(0x153000) @ 0x5f000 08:01 527501 0]: r-xp /path/to/dap.bin +0 0x7c20 [0x88]: PERF_RECORD_MMAP2 3446532/3446532: [0x3b3000(0xc000) @ 0x1b1000 08:01 527501 0]: r--p /path/to/dap.bin +0 0x7ca8 [0x88]: PERF_RECORD_MMAP2 3446532/3446532: [0x3bf000(0x3000) @ 0x1bc000 08:01 527501 0]: rw-p /path/to/dap.bin +1282514021937402 0x8660 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514022939813 0x87b0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3fb0 +1282514023932029 0x8a00 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3fb0 +1282514024937981 0x8d48 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3fb0 +1282514028925828 0x94c0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3fb0 +1282514028934870 0x9678 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3fc0 +1282514029934094 0x9830 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3fb0 +1282514040934785 0xb1d0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3fc0 +1282514052924510 0xcbb8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514053932406 0xcfb0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3fc0 +1282514063928248 0xe5c8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514073928057 0xfd20 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514081925013 0x10f28 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514084927335 0x11678 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514088926926 0x11f90 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514089929492 0x12270 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514119919997 0x16610 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514120924169 0x16920 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514145923603 0x1a338 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514146917708 0x1a428 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514173914003 0x1e1b0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514188915199 0x20488 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514210915866 0x236d8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514212908181 0x23a50 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3f70 +1282514480886012 0x4a098 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80 +1282514840855333 0x7dd48 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80 +1282514955835364 0x8e380 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80 +1282514967839429 0x8fef8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80 +1282515023830209 0x97f98 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80 +1282515356804308 0xc7b28 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80 +1282515410794371 0xcf590 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80 +1282515541786485 0xe2280 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80 +1282515703761203 0xf93c0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 3446532/3446532: 0x2608ac period: 233 addr: 0x3b3f80 diff --git a/llvm/test/tools/llvm-profgen/Inputs/dap-pie.bin b/llvm/test/tools/llvm-profgen/Inputs/dap-pie.bin new file mode 100644 index 0000000000000..c09df29ca12ab Binary files /dev/null and b/llvm/test/tools/llvm-profgen/Inputs/dap-pie.bin differ diff --git a/llvm/test/tools/llvm-profgen/Inputs/dap.bin b/llvm/test/tools/llvm-profgen/Inputs/dap.bin new file mode 100755 index 0000000000000..2b0802d448654 Binary files /dev/null and b/llvm/test/tools/llvm-profgen/Inputs/dap.bin differ diff --git a/llvm/test/tools/llvm-profgen/Inputs/lbr-perf-for-dap.script b/llvm/test/tools/llvm-profgen/Inputs/lbr-perf-for-dap.script new file mode 100644 index 0000000000000..3885fb6daa87c --- /dev/null +++ b/llvm/test/tools/llvm-profgen/Inputs/lbr-perf-for-dap.script @@ -0,0 +1,14 @@ +PERF_RECORD_MMAP2 3446532/3446532: [0x260000(0x153000) @ 0x5f000 08:01 527501 0]: r-xp /path/to/dap.perfbin +PERF_RECORD_MMAP2 3446532/3446532: [0x7fff5ff28000(0x2000) @ 0 00:00 0 0]: r-xp [vdso] +PERF_RECORD_MMAP2 3446532/3446532: [0xffffffffff600000(0x1000) @ 0 00:00 0 0]: --xp [vsyscall] + 350fd4 0x260832/0x260894/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- + 350fd4 0x260832/0x260894/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- + 350ff8 0x2608a2/0x2607f0/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x260c52/0x260827/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/2//- 0x260822/0x260c30/P/-/-/1//- 0x260808/0x26081d/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- + 350866 0x351059/0x351098/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26087a/0x260be0/P/-/-/2//- 0x2608ac/0x260870/P/-/-/1//- 0x2607fc/0x2608a4/P/-/-/2//- 0x2608a2/0x2607f0/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x260c52/0x260827/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/2//- 0x260822/0x260c30/P/-/-/1//- 0x260808/0x26081d/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- + 260880 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- + 26090f 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- + 260884 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- + 2608a0 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26087a/0x260be0/P/-/-/2//- 0x2608ac/0x260870/P/-/-/1//- + 350866 0x351059/0x351098/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26087a/0x260be0/P/-/-/2//- 0x2608ac/0x260870/P/-/-/1//- 0x2607fc/0x2608a4/P/-/-/2//- 0x2608a2/0x2607f0/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x260c52/0x260827/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- + 260800 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- + 260800 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- 0x260c47/0x350850/P/-/-/3//- 0x26080f/0x260c30/P/-/-/1//- 0x26088f/0x260800/P/-/-/3//- 0x26090a/0x260880/P/-/-/1//- 0x26091c/0x260900/P/-/-/1//- 0x2608bb/0x26090f/P/-/-/2//- 0x3510ab/0x2608af/P/-/-/3//- 0x351059/0x351098/P/-/-/7//- 0x350f8c/0x350fb4/P/-/-/4//- 0x260bf4/0x350f40/P/-/-/1//- 0x260be4/0x260bf0/P/-/-/1//- 0x26085a/0x260be0/P/-/-/2//- 0x2608ac/0x260850/P/-/-/1//- 0x26084c/0x2608a4/P/-/-/2//- 0x2608a2/0x260840/P/-/-/2//- 0x260832/0x260894/P/-/-/1//- 0x26081b/0x26082e/P/-/-/1//- 0x260c52/0x260814/P/-/-/1//- 0x3508da/0x260c4c/P/-/-/5//- 0x350879/0x350887/P/-/-/3//- diff --git a/llvm/test/tools/llvm-profgen/Inputs/pie-dap-perf.txt b/llvm/test/tools/llvm-profgen/Inputs/pie-dap-perf.txt new file mode 100644 index 0000000000000..106d2923d1fec --- /dev/null +++ b/llvm/test/tools/llvm-profgen/Inputs/pie-dap-perf.txt @@ -0,0 +1,79 @@ +0 0x2a38 [0xb0]: PERF_RECORD_MMAP2 1725662/1725662: [0x55b978932000(0x1000) @ 0 fd:01 21244721 0]: r--p /usr/local/google/home/mingmingl/llvm-sdp/llvm-project/build/src/dap-pie.bin +0 0x2ae8 [0xb0]: PERF_RECORD_MMAP2 1725662/1725662: [0x55b978933000(0x1000) @ 0 fd:01 21244721 0]: r-xp /usr/local/google/home/mingmingl/llvm-sdp/llvm-project/build/src/dap-pie.bin +0 0x2b98 [0xb0]: PERF_RECORD_MMAP2 1725662/1725662: [0x55b978934000(0x2000) @ 0 fd:01 21244721 0]: r--p /usr/local/google/home/mingmingl/llvm-sdp/llvm-project/build/src/dap-pie.bin +0 0x2c48 [0xb0]: PERF_RECORD_MMAP2 1725662/1725662: [0x55b978936000(0x1000) @ 0x1000 fd:01 21244721 0]: rw-p /usr/local/google/home/mingmingl/llvm-sdp/llvm-project/build/src/dap-pie.bin +712804701634173 0x1e9d0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712804836290301 0x28f68 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712804837605543 0x28fc8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712805007191186 0x35588 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712805018823760 0x36178 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712805020138664 0x361d8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712805113189243 0x3b938 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712805141066561 0x3d290 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712805283363367 0x469d8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712805677956073 0x5fd50 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712805679249452 0x5fdb0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712805693565180 0x601f8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712806019001624 0x816f0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712806020316894 0x81750 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712806032091602 0x81ad8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712806033406859 0x81b38 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712806159075140 0x8b5c0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712808020339685 0x126910 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712808021641071 0x126970 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712808022947274 0x1269d0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712808689837848 0x15d9f8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cdc period: 1000003 addr: 0x55b978934e70 +712808711116732 0x15e5b8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712808711634977 0x15e618 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712808712152486 0x15e678 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cdc period: 1000003 addr: 0x55b978934e70 +712808719972492 0x15eb88 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cdc period: 1000003 addr: 0x55b978934e70 +712808779739123 0x164c78 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cdc period: 1000003 addr: 0x55b978934e70 +712809032526371 0x177348 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712809839042086 0x1ba6c0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712809840367013 0x1ba720 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712810017729661 0x1c8698 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712810019114828 0x1c8760 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712810030692973 0x1c8c00 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712810988845241 0x218cc8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712811415653266 0x239f38 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712811416968337 0x239f98 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712811585896657 0x246f48 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712812025437162 0x26ad10 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712814437226587 0x32b278 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712814438523218 0x32b2d8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712815028856637 0x35c470 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712815030142353 0x35c4d0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712818017027908 0x4577f0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cdc period: 1000003 addr: 0x55b978934e70 +712818021039899 0x457968 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712818022355102 0x4579c8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712818692960009 0x490df0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712819018376007 0x4abe20 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712819048387059 0x4ac708 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712820021151706 0x4fec00 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712822024629005 0x5a3be0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e20 +712823015752028 0x5f3760 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cdc period: 1000003 addr: 0x55b978934e70 +712824020617614 0x6462a0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712824021918372 0x646300 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712826019891672 0x6ec3c8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712826021207387 0x6ec428 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712826022522240 0x6ec488 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712827015608752 0x73ee18 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712827665092533 0x773768 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712828018715780 0x78ef00 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712828423585934 0x7aede8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cdc period: 1000003 addr: 0x55b978934e70 +712829019664051 0x7e0210 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712829395596728 0x7fe558 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712830018663760 0x831e18 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712830023673654 0x831f90 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712830180382629 0x83ebc0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712830180777038 0x83ec20 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712830344366327 0x8468f8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712831478881799 0x899a00 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cdc period: 1000003 addr: 0x55b978934e70 +712831992570428 0x8bec30 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cdc period: 1000003 addr: 0x55b978934e70 +712831999013143 0x8bf080 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712832000314956 0x8bf0e0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712833027320322 0x906c38 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712833188532818 0x9100a0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cd2 period: 1000003 addr: 0x55b978934e60 +712833981258399 0x9498a8 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cdc period: 1000003 addr: 0x55b978934e30 +712833981258450 0x949908 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cdc period: 1000003 addr: 0x55b978934e30 +712833981258510 0x949968 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): 1725662/1725662: 0x55b978933cdc period: 1000003 addr: 0x55b978934e30 diff --git a/llvm/test/tools/llvm-profgen/Inputs/pie-lbr-perf.script b/llvm/test/tools/llvm-profgen/Inputs/pie-lbr-perf.script new file mode 100644 index 0000000000000..9294fc4c3dd67 --- /dev/null +++ b/llvm/test/tools/llvm-profgen/Inputs/pie-lbr-perf.script @@ -0,0 +1,17 @@ +PERF_RECORD_MMAP2 1725662/1725662: [0x55b978933000(0x1000) @ 0 fd:01 21244721 0]: r-xp /usr/local/google/home/mingmingl/llvm-sdp/llvm-project/build/src/dap-pie.bin +PERF_RECORD_MMAP2 1725662/1725662: [0x7f3ffcc32000(0x165000) @ 0x28000 fd:01 20075535 0]: r-xp /usr/lib/x86_64-linux-gnu/libc.so.6 +PERF_RECORD_MMAP2 1725662/1725662: [0x7f3ffce9d000(0x129000) @ 0x9d000 fd:01 20054678 0]: r-xp /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33 +PERF_RECORD_MMAP2 1725662/1725662: [0x7f3ffd0f5000(0x23000) @ 0x4000 fd:01 20059537 0]: r-xp /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 +PERF_RECORD_MMAP2 1725662/1725662: [0x7f3ffd12f000(0x7d000) @ 0x11000 fd:01 20075696 0]: r-xp /usr/lib/x86_64-linux-gnu/libm.so.6 +PERF_RECORD_MMAP2 1725662/1725662: [0x7f3ffd22c000(0x2000) @ 0 00:00 0 0]: r-xp [vdso] +PERF_RECORD_MMAP2 1725662/1725662: [0x7f3ffd22f000(0x28000) @ 0x1000 fd:01 20075532 0]: r-xp /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 + 55b978933cb4 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933c8a/0x55b978933dd0/P/-/-/2//- 0x55b978933cdc/0x55b978933c80/P/-/-/1//- 0x55b978933c7c/0x55b978933cd4/P/-/-/2//- 0x55b978933cd2/0x55b978933c70/P/-/-/3//- 0x55b978933c62/0x55b978933cc4/P/-/-/1//- 0x55b978933c4b/0x55b978933c5e/P/-/-/1//- 0x7f3ffceb3bb2/0x55b978933c44/P/-/-/1//- 0x7f3ffccacbe1/0x7f3ffceb3bac/P/-/-/19//- 0x7f3ffccacb7b/0x7f3ffccacb89/P/-/-/3//- 0x7f3ffce9de50/0x7f3ffccacb50/P/-/-/1//- 0x7f3ffceb3ba7/0x7f3ffce9de50/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c3f/0x55b978933dc0/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/2//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- 0x7f3ffccad356/0x7f3ffccad398/P/-/-/8//- 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933c8a/0x55b978933dd0/P/-/-/2//- + 7f3ffccacbc6 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c52/0x55b978933dc0/P/-/-/1//- 0x55b978933c38/0x55b978933c4d/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/2//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- 0x7f3ffccad356/0x7f3ffccad398/P/-/-/8//- 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933c8a/0x55b978933dd0/P/-/-/2//- 0x55b978933cdc/0x55b978933c80/P/-/-/1//- 0x55b978933c7c/0x55b978933cd4/P/-/-/2//- 0x55b978933cd2/0x55b978933c70/P/-/-/3//- 0x55b978933c62/0x55b978933cc4/P/-/-/1//- 0x55b978933c4b/0x55b978933c5e/P/-/-/1//- 0x7f3ffceb3bb2/0x55b978933c44/P/-/-/1//- 0x7f3ffccacbe1/0x7f3ffceb3bac/P/-/-/19//- 0x7f3ffccacb7b/0x7f3ffccacb89/P/-/-/3//- 0x7f3ffce9de50/0x7f3ffccacb50/P/-/-/1//- 0x7f3ffceb3ba7/0x7f3ffce9de50/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c3f/0x55b978933dc0/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- + 55b978933cc4 0x7f3ffccacb7b/0x7f3ffccacb89/P/-/-/4//- 0x7f3ffce9de50/0x7f3ffccacb50/P/-/-/1//- 0x7f3ffceb3ba7/0x7f3ffce9de50/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c52/0x55b978933dc0/P/-/-/1//- 0x55b978933c38/0x55b978933c4d/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/2//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- 0x7f3ffccad356/0x7f3ffccad398/P/-/-/8//- 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933c8a/0x55b978933dd0/P/-/-/2//- 0x55b978933cdc/0x55b978933c80/P/-/-/1//- 0x55b978933c7c/0x55b978933cd4/P/-/-/2//- 0x55b978933cd2/0x55b978933c70/P/-/-/3//- 0x55b978933c62/0x55b978933cc4/P/-/-/1//- 0x55b978933c4b/0x55b978933c5e/P/-/-/1//- 0x7f3ffceb3bb2/0x55b978933c44/P/-/-/1//- 0x7f3ffccacbe1/0x7f3ffceb3bac/P/-/-/19//- 0x7f3ffccacb7b/0x7f3ffccacb89/P/-/-/3//- 0x7f3ffce9de50/0x7f3ffccacb50/P/-/-/1//- 0x7f3ffceb3ba7/0x7f3ffce9de50/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c3f/0x55b978933dc0/P/-/-/2//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- + 55b978933cba 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933caa/0x55b978933dd0/P/-/-/2//- 0x55b978933cdc/0x55b978933ca0/P/-/-/1//- 0x55b978933c2c/0x55b978933cd4/P/-/-/2//- 0x55b978933cd2/0x55b978933c20/P/-/-/4//- 0x55b978933c62/0x55b978933cc4/P/-/-/1//- 0x7f3ffceb3bb2/0x55b978933c57/P/-/-/1//- 0x7f3ffccacbe1/0x7f3ffceb3bac/P/-/-/16//- 0x7f3ffccacb7b/0x7f3ffccacb89/P/-/-/4//- 0x7f3ffce9de50/0x7f3ffccacb50/P/-/-/1//- 0x7f3ffceb3ba7/0x7f3ffce9de50/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c52/0x55b978933dc0/P/-/-/1//- 0x55b978933c38/0x55b978933c4d/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/2//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- 0x7f3ffccad356/0x7f3ffccad398/P/-/-/8//- 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933c8a/0x55b978933dd0/P/-/-/2//- + 7f3ffccacbbc 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c3f/0x55b978933dc0/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/2//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- 0x7f3ffccad356/0x7f3ffccad398/P/-/-/8//- 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933caa/0x55b978933dd0/P/-/-/2//- 0x55b978933cdc/0x55b978933ca0/P/-/-/1//- 0x55b978933c2c/0x55b978933cd4/P/-/-/2//- 0x55b978933cd2/0x55b978933c20/P/-/-/4//- 0x55b978933c62/0x55b978933cc4/P/-/-/1//- 0x7f3ffceb3bb2/0x55b978933c57/P/-/-/1//- 0x7f3ffccacbe1/0x7f3ffceb3bac/P/-/-/16//- 0x7f3ffccacb7b/0x7f3ffccacb89/P/-/-/4//- 0x7f3ffce9de50/0x7f3ffccacb50/P/-/-/1//- 0x7f3ffceb3ba7/0x7f3ffce9de50/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c52/0x55b978933dc0/P/-/-/1//- 0x55b978933c38/0x55b978933c4d/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/2//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- + 7f3ffccacba7 0x55b978933cbf/0x55b978933c30/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/2//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- 0x7f3ffccad356/0x7f3ffccad398/P/-/-/8//- 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933c8a/0x55b978933dd0/P/-/-/2//- 0x55b978933cdc/0x55b978933c80/P/-/-/1//- 0x55b978933c7c/0x55b978933cd4/P/-/-/2//- 0x55b978933cd2/0x55b978933c70/P/-/-/3//- 0x55b978933c62/0x55b978933cc4/P/-/-/1//- 0x55b978933c4b/0x55b978933c5e/P/-/-/1//- 0x7f3ffceb3bb2/0x55b978933c44/P/-/-/1//- 0x7f3ffccacbe1/0x7f3ffceb3bac/P/-/-/17//- 0x7f3ffccacb7b/0x7f3ffccacb89/P/-/-/4//- 0x7f3ffce9de50/0x7f3ffccacb50/P/-/-/1//- 0x7f3ffceb3ba7/0x7f3ffce9de50/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c3f/0x55b978933dc0/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/2//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- 0x7f3ffccad356/0x7f3ffccad398/P/-/-/8//- + 7f3ffccad320 0x55b978933caa/0x55b978933dd0/P/-/-/1//- 0x55b978933caa/0x55b978933dd0/P/-/-/2//- 0x55b978933cdc/0x55b978933ca0/P/-/-/1//- 0x55b978933c2c/0x55b978933cd4/P/-/-/2//- 0x55b978933cd2/0x55b978933c20/P/-/-/4//- 0x55b978933c62/0x55b978933cc4/P/-/-/1//- 0x7f3ffceb3bb2/0x55b978933c57/P/-/-/1//- 0x7f3ffccacbe1/0x7f3ffceb3bac/P/-/-/16//- 0x7f3ffccacb7b/0x7f3ffccacb89/P/-/-/3//- 0x7f3ffce9de50/0x7f3ffccacb50/P/-/-/1//- 0x7f3ffceb3ba7/0x7f3ffce9de50/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c52/0x55b978933dc0/P/-/-/1//- 0x55b978933c38/0x55b978933c4d/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/2//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- 0x7f3ffccad356/0x7f3ffccad398/P/-/-/8//- 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933c8a/0x55b978933dd0/P/-/-/2//- 0x55b978933cdc/0x55b978933c80/P/-/-/1//- 0x55b978933c7c/0x55b978933cd4/P/-/-/2//- 0x55b978933cd2/0x55b978933c70/P/-/-/3//- 0x55b978933c62/0x55b978933cc4/P/-/-/1//- 0x55b978933c4b/0x55b978933c5e/P/-/-/1//- + 7f3ffccacba7 0x55b978933cbf/0x55b978933c30/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/2//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- 0x7f3ffccad356/0x7f3ffccad398/P/-/-/8//- 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933c8a/0x55b978933dd0/P/-/-/2//- 0x55b978933cdc/0x55b978933c80/P/-/-/1//- 0x55b978933c7c/0x55b978933cd4/P/-/-/2//- 0x55b978933cd2/0x55b978933c70/P/-/-/3//- 0x55b978933c62/0x55b978933cc4/P/-/-/1//- 0x55b978933c4b/0x55b978933c5e/P/-/-/1//- 0x7f3ffceb3bb2/0x55b978933c44/P/-/-/1//- 0x7f3ffccacbe1/0x7f3ffceb3bac/P/-/-/19//- 0x7f3ffccacb7b/0x7f3ffccacb89/P/-/-/3//- 0x7f3ffce9de50/0x7f3ffccacb50/P/-/-/1//- 0x7f3ffceb3ba7/0x7f3ffce9de50/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c3f/0x55b978933dc0/P/-/-/2//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/3//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- 0x7f3ffccad356/0x7f3ffccad398/P/-/-/8//- + 7f3ffccacbcd 0x7f3ffccacb7b/0x7f3ffccacb89/P/-/-/3//- 0x7f3ffce9de50/0x7f3ffccacb50/P/-/-/1//- 0x7f3ffceb3ba7/0x7f3ffce9de50/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c52/0x55b978933dc0/P/-/-/1//- 0x55b978933c38/0x55b978933c4d/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/2//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- 0x7f3ffccad356/0x7f3ffccad398/P/-/-/8//- 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933c8a/0x55b978933dd0/P/-/-/2//- 0x55b978933cdc/0x55b978933c80/P/-/-/1//- 0x55b978933c7c/0x55b978933cd4/P/-/-/2//- 0x55b978933cd2/0x55b978933c70/P/-/-/5//- 0x55b978933c62/0x55b978933cc4/P/-/-/1//- 0x55b978933c4b/0x55b978933c5e/P/-/-/1//- 0x7f3ffceb3bb2/0x55b978933c44/P/-/-/1//- 0x7f3ffccacbe1/0x7f3ffceb3bac/P/-/-/13//- 0x7f3ffccacb7b/0x7f3ffccacb89/P/-/-/4//- 0x7f3ffce9de50/0x7f3ffccacb50/P/-/-/1//- 0x7f3ffceb3ba7/0x7f3ffce9de50/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c3f/0x55b978933dc0/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- + 55b978933cb0 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933c8a/0x55b978933dd0/P/-/-/2//- 0x55b978933cdc/0x55b978933c80/P/-/-/1//- 0x55b978933c7c/0x55b978933cd4/P/-/-/2//- 0x55b978933cd2/0x55b978933c70/P/-/-/3//- 0x55b978933c62/0x55b978933cc4/P/-/-/1//- 0x55b978933c4b/0x55b978933c5e/P/-/-/1//- 0x7f3ffceb3bb2/0x55b978933c44/P/-/-/1//- 0x7f3ffccacbe1/0x7f3ffceb3bac/P/-/-/19//- 0x7f3ffccacb7b/0x7f3ffccacb89/P/-/-/3//- 0x7f3ffce9de50/0x7f3ffccacb50/P/-/-/1//- 0x7f3ffceb3ba7/0x7f3ffce9de50/P/-/-/2//- 0x55b978933dc0/0x7f3ffceb3b90/P/-/-/1//- 0x55b978933c3f/0x55b978933dc0/P/-/-/1//- 0x55b978933cbf/0x55b978933c30/P/-/-/3//- 0x55b978933d3a/0x55b978933cb0/P/-/-/1//- 0x55b978933d4c/0x55b978933d30/P/-/-/1//- 0x55b978933ceb/0x55b978933d3f/P/-/-/2//- 0x7f3ffccad3ab/0x55b978933cdf/P/-/-/2//- 0x7f3ffccad356/0x7f3ffccad398/P/-/-/8//- 0x7f3ffccad28e/0x7f3ffccad2b6/P/-/-/4//- 0x7f3ffce9e890/0x7f3ffccad240/P/-/-/1//- 0x7f3ffceb1d64/0x7f3ffce9e890/P/-/-/1//- 0x7f3ffce9e070/0x7f3ffceb1d60/P/-/-/1//- 0x7f3ffceb1d74/0x7f3ffce9e070/P/-/-/1//- 0x55b978933dd0/0x7f3ffceb1d70/P/-/-/1//- 0x55b978933c8a/0x55b978933dd0/P/-/-/2//- diff --git a/llvm/test/tools/llvm-profgen/afdo-with-vtable-pie.test b/llvm/test/tools/llvm-profgen/afdo-with-vtable-pie.test new file mode 100644 index 0000000000000..b51cf33d7f26c --- /dev/null +++ b/llvm/test/tools/llvm-profgen/afdo-with-vtable-pie.test @@ -0,0 +1,19 @@ + +RUN: llvm-profgen --perfscript=%p/Inputs/pie-lbr-perf.script \ +RUN: --data-access-profile=%p/Inputs/pie-dap-perf.txt \ +RUN: --binary=%p/Inputs/dap-pie.bin --format=text --pid=1725662 \ +RUN: -ignore-stack-samples -use-dwarf-correlation -o %t.afdo + +RUN: llvm-profdata show --sample --function=_Z9loop_funciii %t.afdo 2>&1 | FileCheck %s --dump-input=always + +CHECK: Function: _Z9loop_funciii: 746, 14, 5 sampled lines +CHECK-NEXT: Samples collected in the function's body { +CHECK-NEXT: 0: 14 +CHECK-NEXT: 1: 18, calls: _Z10createTypei:18 +CHECK-NEXT: 3: 11, calls: _ZN12_GLOBAL__N_18Derived24funcEii:8 _ZN8Derived14funcEii:3 +CHECK-NEXT: 3: vtables: _ZTV8Derived1:16 _ZTVN12_GLOBAL__N_18Derived2E:47 +CHECK-NEXT: 5.1: 11, calls: _ZN12_GLOBAL__N_18Derived2D0Ev:8 _ZN8Derived1D0Ev:3 +CHECK-NEXT: 5.1: vtables: _ZTV8Derived1:3 _ZTVN12_GLOBAL__N_18Derived2E:9 +CHECK-NEXT: 7: 13 +CHECK-NEXT: } +CHECK-NEXT: No inlined callsites in this function diff --git a/llvm/test/tools/llvm-profgen/afdo-with-vtable.test b/llvm/test/tools/llvm-profgen/afdo-with-vtable.test new file mode 100644 index 0000000000000..14d743c3667a6 --- /dev/null +++ b/llvm/test/tools/llvm-profgen/afdo-with-vtable.test @@ -0,0 +1,18 @@ +RUN: llvm-profgen --perfscript=%p/Inputs/lbr-perf-for-dap.script --data-access-profile=%p/Inputs/dap-perf-trace.txt \ +RUN: --binary=%p/Inputs/dap.bin --format=text --pid=3446532 \ +RUN: -ignore-stack-samples -use-dwarf-correlation -o %t.afdo + +RUN: llvm-profdata show --sample --function=_Z9loop_funciii %t.afdo 2>&1 | FileCheck %s + +CHECK: Function: _Z9loop_funciii: 958, 15, 5 sampled lines +CHECK-NEXT: Samples collected in the function's body { +CHECK-NEXT: 0: 15 +CHECK-NEXT: 1: 19, calls: _Z10createTypei:15 +CHECK-NEXT: 3: 19, calls: _ZN12_GLOBAL__N_18Derived24funcEii:16 _ZN8Derived14funcEii:3 +CHECK-NEXT: 3: vtables: _ZTV8Derived1:16 _ZTVN12_GLOBAL__N_18Derived2E:5 +CHECK-NEXT: 5.1: 19, calls: _ZN12_GLOBAL__N_18Derived2D0Ev:16 _ZN8Derived1D0Ev:3 +CHECK-NEXT: 5.1: vtables: _ZTV8Derived1:9 _ZTVN12_GLOBAL__N_18Derived2E:3 +CHECK-NEXT: 7: 12 +CHECK-NEXT: } +CHECK-NEXT: No inlined callsites in this function + diff --git a/llvm/tools/llvm-profgen/PerfReader.cpp b/llvm/tools/llvm-profgen/PerfReader.cpp index ad113eda27914..eb152577a72af 100644 --- a/llvm/tools/llvm-profgen/PerfReader.cpp +++ b/llvm/tools/llvm-profgen/PerfReader.cpp @@ -6,10 +6,14 @@ // //===----------------------------------------------------------------------===// #include "PerfReader.h" +#include "ErrorHandling.h" +#include "PerfReader.h" #include "ProfileGenerator.h" #include "llvm/ADT/SmallString.h" #include "llvm/DebugInfo/Symbolize/SymbolizableModule.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/LineIterator.h" +#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Process.h" #include "llvm/Support/ToolOutputFile.h" @@ -370,6 +374,77 @@ PerfReaderBase::create(ProfiledBinary *Binary, PerfInputFile &PerfInput, return PerfReader; } +Error PerfReaderBase::parseDataAccessPerfTraces( + StringRef DataAccessPerfTraceFile, std::optional PIDFilter) { + // A perf_record_sample line is like + // . 1282514022939813 0x87b0 [0x60]: PERF_RECORD_SAMPLE(IP, 0x4002): + // 3446532/3446532: 0x2608a2 period: 233 addr: 0x3b3fb0 + constexpr static StringRef DataAccessSamplePattern = + "PERF_RECORD_SAMPLE\\([A-Za-z]+, 0x[0-9a-fA-F]+\\): " + "([0-9]+)\\/[0-9]+: 0x([0-9a-fA-F]+) period: [0-9]+ addr: " + "0x([0-9a-fA-F]+)"; + + llvm::Regex LogRegex(DataAccessSamplePattern); + + auto BufferOrErr = MemoryBuffer::getFile(DataAccessPerfTraceFile); + std::error_code EC = BufferOrErr.getError(); + if (EC) + return make_error("Failed to open perf trace file: " + + DataAccessPerfTraceFile, + inconvertibleErrorCode()); + + assert(!SampleCounters.empty() && "Sample counters should not be empty!"); + SampleCounter &Counter = SampleCounters.begin()->second; + line_iterator LineIt(*BufferOrErr.get(), true); + + for (; !LineIt.is_at_eof(); ++LineIt) { + StringRef Line = *LineIt; + + MMapEvent MMap; + if (Line.contains("PERF_RECORD_MMAP2")) { + if (PerfScriptReader::extractMMapEventForBinary(Binary, Line, MMap)) { + if (!MMap.MemProtectionFlag.contains("x")) { + if (Error E = Binary->addMMapNonTextEvent(MMap)) { + return E; + } + } + } + continue; + } + + SmallVector Fields; + if (LogRegex.match(Line, &Fields)) { + int32_t PID = 0; + if (Fields[1].getAsInteger(10, PID)) + return make_error( + "Failed to parse PID from perf trace line: " + Line, + inconvertibleErrorCode()); + + if (PIDFilter.has_value() && *PIDFilter != PID) { + continue; + } + + uint64_t DataAddress = 0; + if (Fields[3].getAsInteger(16, DataAddress)) + return make_error( + "Failed to parse data address from perf trace line: " + Line, + inconvertibleErrorCode()); + // Out of all the memory access events, the vtable accesses are used to + // construct type profiles. We assume that this is under the Itanium + // C++ ABI so we can use `_ZTV` prefix to identify vtable. + StringRef DataSymbol = Binary->symbolizeDataAddress( + Binary->CanonicalizeNonTextAddress(DataAddress)); + if (DataSymbol.starts_with("_ZTV")) { + uint64_t IP = 0; + Fields[2].getAsInteger(16, IP); + Counter.recordDataAccessCount(Binary->canonicalizeVirtualAddress(IP), + DataSymbol, 1); + } + } + } + return Error::success(); +} + PerfInputFile PerfScriptReader::convertPerfDataToTrace(ProfiledBinary *Binary, bool SkipPID, PerfInputFile &File, @@ -990,14 +1065,14 @@ bool PerfScriptReader::extractMMapEventForBinary(ProfiledBinary *Binary, constexpr static const char *const MMap2Pattern = "PERF_RECORD_MMAP2 (-?[0-9]+)/[0-9]+: " "\\[(0x[a-f0-9]+)\\((0x[a-f0-9]+)\\) @ " - "(0x[a-f0-9]+|0) .*\\]: [-a-z]+ (.*)"; + "(0x[a-f0-9]+|0) .*\\]: ([-a-z]+) (.*)"; // Parse a MMap line like // PERF_RECORD_MMAP -1/0: [0xffffffff81e00000(0x3e8fa000) @ \ // 0xffffffff81e00000]: x [kernel.kallsyms]_text constexpr static const char *const MMapPattern = "PERF_RECORD_MMAP (-?[0-9]+)/[0-9]+: " "\\[(0x[a-f0-9]+)\\((0x[a-f0-9]+)\\) @ " - "(0x[a-f0-9]+|0)\\]: [-a-z]+ (.*)"; + "(0x[a-f0-9]+|0)\\]: ([-a-z]+) (.*)"; // Field 0 - whole line // Field 1 - PID // Field 2 - base address @@ -1010,11 +1085,12 @@ bool PerfScriptReader::extractMMapEventForBinary(ProfiledBinary *Binary, MMAPPED_ADDRESS = 2, MMAPPED_SIZE = 3, PAGE_OFFSET = 4, - BINARY_PATH = 5 + MEM_PROTECTION_FLAG = 5, + BINARY_PATH = 6, }; bool R = false; - SmallVector Fields; + SmallVector Fields; if (Line.contains("PERF_RECORD_MMAP2 ")) { Regex RegMmap2(MMap2Pattern); R = RegMmap2.match(Line, &Fields); @@ -1035,6 +1111,7 @@ bool PerfScriptReader::extractMMapEventForBinary(ProfiledBinary *Binary, Fields[MMAPPED_ADDRESS].getAsInteger(0, MMap.Address); Fields[MMAPPED_SIZE].getAsInteger(0, MMap.Size); Fields[PAGE_OFFSET].getAsInteger(0, MMap.Offset); + MMap.MemProtectionFlag = Fields[MEM_PROTECTION_FLAG]; MMap.BinaryPath = Fields[BINARY_PATH]; if (ShowMmapEvents) { outs() << "Mmap: Binary " << MMap.BinaryPath << " loaded at " diff --git a/llvm/tools/llvm-profgen/PerfReader.h b/llvm/tools/llvm-profgen/PerfReader.h index 4b3ac8f569755..4da37dd07f800 100644 --- a/llvm/tools/llvm-profgen/PerfReader.h +++ b/llvm/tools/llvm-profgen/PerfReader.h @@ -12,6 +12,7 @@ #include "ProfiledBinary.h" #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Error.h" #include "llvm/Support/Regex.h" #include #include @@ -395,10 +396,14 @@ using BranchSample = std::map, uint64_t>; // The counter of range samples for one function indexed by the range, // which is represented as the start and end offset pair. using RangeSample = std::map, uint64_t>; +// <, count> map for data access samples. +// The instruction address is the virtual address in the binary. +using DataAccessSample = std::map, uint64_t>; // Wrapper for sample counters including range counter and branch counter struct SampleCounter { RangeSample RangeCounter; BranchSample BranchCounter; + DataAccessSample DataAccessCounter; void recordRangeCount(uint64_t Start, uint64_t End, uint64_t Repeat) { assert(Start <= End && "Invalid instruction range"); @@ -407,6 +412,10 @@ struct SampleCounter { void recordBranchCount(uint64_t Source, uint64_t Target, uint64_t Repeat) { BranchCounter[{Source, Target}] += Repeat; } + void recordDataAccessCount(uint64_t InstAddr, StringRef DataSymbol, + uint64_t Repeat) { + DataAccessCounter[{InstAddr, DataSymbol}] += Repeat; + } }; // Sample counter with context to support context-sensitive profile @@ -572,6 +581,13 @@ class PerfReaderBase { // Entry of the reader to parse multiple perf traces virtual void parsePerfTraces() = 0; + + // Parse the from the data access perf trace file, + // and accumulate the data access count for each pair. + Error + parseDataAccessPerfTraces(StringRef DataAccessPerfFile, + std::optional PIDFilter = std::nullopt); + const ContextSampleCounterMap &getSampleCounters() const { return SampleCounters; } @@ -598,6 +614,14 @@ class PerfScriptReader : public PerfReaderBase { // Entry of the reader to parse multiple perf traces void parsePerfTraces() override; + + // Parse a single line of a PERF_RECORD_MMAP event looking for a + // mapping between the binary name and its memory layout. + // TODO: Move this static method from PerScriptReader (subclass) to + // PerfReaderBase (superclass). + static bool extractMMapEventForBinary(ProfiledBinary *Binary, StringRef Line, + MMapEvent &MMap); + // Generate perf script from perf data static PerfInputFile convertPerfDataToTrace(ProfiledBinary *Binary, bool SkipPID, PerfInputFile &File, @@ -611,23 +635,10 @@ class PerfScriptReader : public PerfReaderBase { static SmallVector TempFileCleanups; protected: - // The parsed MMap event - struct MMapEvent { - int64_t PID = 0; - uint64_t Address = 0; - uint64_t Size = 0; - uint64_t Offset = 0; - StringRef BinaryPath; - }; - // Check whether a given line is LBR sample static bool isLBRSample(StringRef Line); // Check whether a given line is MMAP event static bool isMMapEvent(StringRef Line); - // Parse a single line of a PERF_RECORD_MMAP event looking for a - // mapping between the binary name and its memory layout. - static bool extractMMapEventForBinary(ProfiledBinary *Binary, StringRef Line, - MMapEvent &MMap); // Update base address based on mmap events void updateBinaryAddress(const MMapEvent &Event); // Parse mmap event and update binary address diff --git a/llvm/tools/llvm-profgen/ProfileGenerator.cpp b/llvm/tools/llvm-profgen/ProfileGenerator.cpp index db686c3b597eb..ef66160fd2bee 100644 --- a/llvm/tools/llvm-profgen/ProfileGenerator.cpp +++ b/llvm/tools/llvm-profgen/ProfileGenerator.cpp @@ -540,6 +540,22 @@ void ProfileGenerator::generateLineNumBasedProfile() { // Fill in boundary sample counts as well as call site samples for calls populateBoundarySamplesForAllFunctions(SC.BranchCounter); + // For each instruction with vtable accesses, get its symbolized inline + // stack, and add the vtable counters to the function samples. + for (const auto &[IpData, Count] : SC.DataAccessCounter) { + uint64_t InstAddr = IpData.first; + const SampleContextFrameVector &FrameVec = + Binary->getCachedFrameLocationStack(InstAddr, false); + if (!FrameVec.empty()) { + FunctionSamples &FunctionProfile = + getLeafProfileAndAddTotalSamples(FrameVec, 0); + LineLocation Loc( + FrameVec.back().Location.LineOffset, + getBaseDiscriminator(FrameVec.back().Location.Discriminator)); + FunctionProfile.addTypeSamplesAt(Loc, FunctionId(IpData.second), Count); + } + } + updateFunctionSamples(); } diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp index 6847ba1b21b1f..0ddd09d455803 100644 --- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp +++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp @@ -336,6 +336,12 @@ void ProfiledBinary::setPreferredTextSegmentAddresses(const ELFFile &Obj, PreferredTextSegmentAddresses.push_back(Phdr.p_vaddr & ~(PageSize - 1U)); TextSegmentOffsets.push_back(Phdr.p_offset & ~(PageSize - 1U)); + } else { + PhdrInfo Info; + Info.FileOffset = Phdr.p_offset; + Info.FileSz = Phdr.p_filesz; + Info.VirtualAddr = Phdr.p_vaddr; + NonTextPhdrInfo.push_back(Info); } } } @@ -344,6 +350,36 @@ void ProfiledBinary::setPreferredTextSegmentAddresses(const ELFFile &Obj, exitWithError("no executable segment found", FileName); } +uint64_t ProfiledBinary::CanonicalizeNonTextAddress(uint64_t Address) { + uint64_t FileOffset = 0; + auto MMapIter = NonTextMMapEvents.lower_bound(Address); + if (MMapIter == NonTextMMapEvents.end()) + return Address; // No non-text mmap event found, return the address as is. + + const auto &MMapEvent = MMapIter->second; + + // If the address is within the non-text mmap event, calculate its file + // offset in the binary. + if (MMapEvent.Address <= Address && + Address < MMapEvent.Address + MMapEvent.Size) + FileOffset = Address - MMapEvent.Address + MMapEvent.Offset; + + // If the address is not within the non-text mmap event, return the address + // as is. + if (FileOffset == 0) + return Address; + + for (const auto &PhdrInfo : NonTextPhdrInfo) { + // Find the program section that contains the file offset and map the + // file offset to the virtual address. + if (PhdrInfo.FileOffset <= FileOffset && + FileOffset < PhdrInfo.FileOffset + PhdrInfo.FileSz) + return PhdrInfo.VirtualAddr + (FileOffset - PhdrInfo.FileOffset); + } + + return Address; +} + void ProfiledBinary::setPreferredTextSegmentAddresses(const COFFObjectFile *Obj, StringRef FileName) { uint64_t ImageBase = Obj->getImageBase(); @@ -913,11 +949,10 @@ SampleContextFrameVector ProfiledBinary::symbolize(const InstructionPointer &IP, bool UseProbeDiscriminator) { assert(this == IP.Binary && "Binary should only symbolize its own instruction"); - auto Addr = object::SectionedAddress{IP.Address, - object::SectionedAddress::UndefSection}; - DIInliningInfo InlineStack = unwrapOrError( - Symbolizer->symbolizeInlinedCode(SymbolizerPath.str(), Addr), - SymbolizerPath); + DIInliningInfo InlineStack = + unwrapOrError(Symbolizer->symbolizeInlinedCode( + SymbolizerPath.str(), getSectionedAddress(IP.Address)), + SymbolizerPath); SampleContextFrameVector CallStack; for (int32_t I = InlineStack.getNumberOfFrames() - 1; I >= 0; I--) { @@ -946,6 +981,16 @@ SampleContextFrameVector ProfiledBinary::symbolize(const InstructionPointer &IP, return CallStack; } +StringRef ProfiledBinary::symbolizeDataAddress(uint64_t Address) { + DIGlobal DataDIGlobal = + unwrapOrError(Symbolizer->symbolizeData(SymbolizerPath.str(), + getSectionedAddress(Address)), + SymbolizerPath); + decltype(NameStrings)::iterator Iter; + std::tie(Iter, std::ignore) = NameStrings.insert(DataDIGlobal.Name); + return StringRef(*Iter); +} + void ProfiledBinary::computeInlinedContextSizeForRange(uint64_t RangeBegin, uint64_t RangeEnd) { InstructionPointer IP(this, RangeBegin, true); diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.h b/llvm/tools/llvm-profgen/ProfiledBinary.h index 0588cb48b2af6..4b3a089552a1f 100644 --- a/llvm/tools/llvm-profgen/ProfiledBinary.h +++ b/llvm/tools/llvm-profgen/ProfiledBinary.h @@ -185,6 +185,16 @@ class BinarySizeContextTracker { using AddressRange = std::pair; +// The parsed MMap event +struct MMapEvent { + int64_t PID = 0; + uint64_t Address = 0; + uint64_t Size = 0; + uint64_t Offset = 0; + StringRef MemProtectionFlag; + StringRef BinaryPath; +}; + class ProfiledBinary { // Absolute path of the executable binary. std::string Path; @@ -276,6 +286,19 @@ class ProfiledBinary { // String table owning function name strings created from the symbolizer. std::unordered_set NameStrings; + // MMap events for PT_LOAD segments without 'x' memory protection flag. + std::map> NonTextMMapEvents; + + // Records the file offset, file size and virtual address of program headers. + struct PhdrInfo { + uint64_t FileOffset; + uint64_t FileSz; + uint64_t VirtualAddr; + }; + + // Program header information for non-text PT_LOAD segments. + SmallVector NonTextPhdrInfo; + // A collection of functions to print disassembly for. StringSet<> DisassembleFunctionSet; @@ -305,6 +328,16 @@ class ProfiledBinary { void setPreferredTextSegmentAddresses(const ObjectFile *O); + // LLVMSymbolizer's symbolize{Code, Data} interfaces requires a section index + // for each address to be symbolized. This is a helper function to + // construct a SectionedAddress object with the given address and section + // index. The section index is set to UndefSection by default. + static object::SectionedAddress getSectionedAddress( + uint64_t Address, + uint64_t SectionIndex = object::SectionedAddress::UndefSection) { + return object::SectionedAddress{Address, SectionIndex}; + } + template void setPreferredTextSegmentAddresses(const ELFFile &Obj, StringRef FileName); @@ -363,6 +396,10 @@ class ProfiledBinary { ProfiledBinary(const StringRef ExeBinPath, const StringRef DebugBinPath); ~ProfiledBinary(); + /// Symbolize an address and return the symbol name. The returned StringRef is + /// owned by this ProfiledBinary object. + StringRef symbolizeDataAddress(uint64_t Address); + void decodePseudoProbe(); StringRef getPath() const { return Path; } @@ -501,7 +538,7 @@ class ProfiledBinary { void setProfiledFunctions(std::unordered_set &Funcs) { ProfiledFunctions = Funcs; } - + BinaryFunction *getBinaryFunction(FunctionId FName) { if (FName.isStringRef()) { auto I = BinaryFunctions.find(FName.str()); @@ -603,6 +640,46 @@ class ProfiledBinary { return ProbeDecoder.getInlinerDescForProbe(Probe); } + bool isNonOverlappingAddressInterval(std::pair LHS, + std::pair RHS) { + if (LHS.second <= RHS.first || RHS.second <= LHS.first) + return true; + return false; + } + + Error addMMapNonTextEvent(MMapEvent Event) { + // Given the mmap events of the profiled binary, the virtual address + // intervals of mmaps most often doesn't overlap with each other. The + // implementation validates so, and runtime data address is mapped to + // a mmap event using look-up. With this implementation, data addresses + // from dynamic shared libraries (not the profiled binary) are not mapped or + // symbolized. To map runtime address to binary address in case of + // overlapping mmap events, the implementation could store all the mmap + // events in a vector and in the order they are added and reverse iterate + // the vector to find the mmap events. We opt'ed for the non-overlapping + // implementation for simplicity. + for (const auto &ExistingMMap : NonTextMMapEvents) { + if (isNonOverlappingAddressInterval( + {ExistingMMap.second.Address, + ExistingMMap.second.Address + ExistingMMap.second.Size}, + {Event.Address, Event.Address + Event.Size})) { + continue; + } + return createStringError( + inconvertibleErrorCode(), + "Non-text mmap event overlaps with existing event at address: %lx", + Event.Address); + } + NonTextMMapEvents[Event.Address] = Event; + return Error::success(); + } + + // Given a non-text runtime address, canonicalize it to the virtual address in + // the binary. + // TODO: Consider unifying the canonicalization of text and non-text addresses + // in the ProfiledBinary class. + uint64_t CanonicalizeNonTextAddress(uint64_t Address); + bool getTrackFuncContextSize() { return TrackFuncContextSize; } bool getIsLoadedByMMap() { return IsLoadedByMMap; } diff --git a/llvm/tools/llvm-profgen/llvm-profgen.cpp b/llvm/tools/llvm-profgen/llvm-profgen.cpp index 3b974e25103ad..7924844bc0c10 100644 --- a/llvm/tools/llvm-profgen/llvm-profgen.cpp +++ b/llvm/tools/llvm-profgen/llvm-profgen.cpp @@ -67,6 +67,11 @@ static cl::opt DebugBinPath( "from it instead of the executable binary."), cl::cat(ProfGenCategory)); +static cl::opt DataAccessProfileFilename( + "data-access-profile", cl::value_desc("data-access-profile"), + cl::desc("Path to the data access profile to be generated."), + cl::cat(ProfGenCategory)); + extern cl::opt ShowDisassemblyOnly; extern cl::opt ShowSourceLocations; extern cl::opt SkipSymbolization; @@ -179,6 +184,18 @@ int main(int argc, const char *argv[]) { // Parse perf events and samples Reader->parsePerfTraces(); + if (!DataAccessProfileFilename.empty()) { + // Parse the data access perf traces into pairs, symbolize + // the data-addr to data-symbol. If the data-addr is a vtable, increment + // counters for the pair. + if (Error E = Reader->parseDataAccessPerfTraces(DataAccessProfileFilename, + PIDFilter)) { + handleAllErrors(std::move(E), [&](const StringError &SE) { + exitWithError(SE.getMessage()); + }); + } + } + if (SkipSymbolization) return EXIT_SUCCESS;