[Mlir-commits] [clang-tools-extra] [libunwind] [libcxx] [llvm] [libc] [mlir] [compiler-rt] [lldb] [clang] [flang] [lld] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)
Mingming Liu
llvmlistbot at llvm.org
Sun Jan 21 22:37:56 PST 2024
minglotus-6 wrote:
I created a [branch](https://github.com/minglotus-6/llvm-project/tree/type_profile) and submitted the end-to-end implementation there. Besides (a [squashed version](https://github.com/llvm/llvm-project/commit/de71eacf04a236031be6f1b53168f8f566244297) of) this pull request, the rest of the branch contains [thinlto import of vtables](https://github.com/llvm/llvm-project/commit/f6c1fc894717c6e7c2b591868b20e85aaa5b7b6a) and actual icp transformations ([commit 1](https://github.com/llvm/llvm-project/commit/094c8a9aa5b5f2bc30d3db5e1332f0a81a3f0411) and [2](https://github.com/llvm/llvm-project/commit/84582fef567b1839ca73ab14735b6cbdc8adc073))
> we could first teach profile reader to understand new sections in a forward compatible way without bumping the version and let it soak everywhere (e.g, for a few weeks), and increase the version number as a second change. I'm planning to make some progress on this aspect and might also discuss f2f.
(Overdue public update) Turns out it's not feasible to pursue backward compatibility with raw profiles, or forward compatibility with indexed profiles without breaking them at least once. For instance, currently, the indexed profile reader relies on the C++ struct [definition](https://github.com/llvm/llvm-project/blob/a31a60074717fc40887cfe132b77eec93bedd307/llvm/include/llvm/ProfileData/InstrProf.h#L1040-L1063) of Header (e.g., the layout of fields) [to know the byte size of the profile header](https://github.com/llvm/llvm-project/blob/a31a60074717fc40887cfe132b77eec93bedd307/llvm/lib/ProfileData/InstrProf.cpp#L1549-L1570). As a result, older compilers won't be able to tell the byte size of header C++ struct if any new field is added in the header C++ struct (i.e., recording byte size in Header breaks forward compat once). So the code changes in the branch above doesn't make any effort to have additional version compat other than what's guaranteed currently (i.e. none for raw profiles, and backward compat for indexed profiles).
https://github.com/llvm/llvm-project/pull/66825
More information about the Mlir-commits
mailing list