[CSSPGO][llvm-profgen] Always report dangling probes for frames with real samples.
authorHongtao Yu <hoy@fb.com>
Tue, 20 Apr 2021 01:04:43 +0000 (18:04 -0700)
committerHongtao Yu <hoy@fb.com>
Thu, 22 Apr 2021 01:07:58 +0000 (18:07 -0700)
commit1a719089a81b418b480e8b08d2d971fb087860db
tree1da5c92ed802658fbaba14cbb37dc7fe6d9a4f59
parent3511022f5f0a8cce67b41a63c33f4f84159968e9
[CSSPGO][llvm-profgen] Always report dangling probes for frames with real samples.

Report dangling probes for frames that have real samples collected. Dangling probes are the probes associated to an empty block. When reported, sample count on a dangling probe will not be trusted by the compiler and we will rely on the counts inference algorithm to get the probe a reasonable count. This actually fixes a bug where previously only those dangling probes with samples collected were reported.

This patch also fixes two existing issues. Pseudo probes are stored in `Address2ProbesMap` and their pointers are used in `PseudoProbeInlineTree`. Previously `std::vector` was used to store probes and the pointers to probes may get obsolete as the vector grows. I'm changing `std::vector` to `std::list` instead.

The other issue is that all outlined functions shared the same inline frame previously due to the unchanged `Index` value as the dummy inlineSite identifier.

Good results seen for SPEC2017 in general regarding profile quality.

Reviewed By: wenlei, wlei

Differential Revision: https://reviews.llvm.org/D100235
llvm/include/llvm/MC/MCPseudoProbe.h
llvm/test/tools/llvm-profgen/Inputs/inline-cs-dangling-pseudoprobe.perfscript [new file with mode: 0644]
llvm/test/tools/llvm-profgen/inline-cs-dangling-pseudoprobe.test [new file with mode: 0644]
llvm/test/tools/llvm-profgen/merge-cold-profile.test
llvm/tools/llvm-profgen/ProfileGenerator.cpp
llvm/tools/llvm-profgen/PseudoProbe.cpp
llvm/tools/llvm-profgen/PseudoProbe.h