[compiler-rt] [llvm] Reland "[TypeProf][InstrPGO] Introduce raw and instr profile format change for type profiling." (PR #82711)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 15:34:52 PST 2024


minglotus-6 wrote:

Update: I got the Windows machine. Windows linker magic [1] works out without compile errors or bad side effects, but the current type profiling won't work under MSVC ABI.  Thereby helper functions in `compiler-rt/lib/profile/InstrProfilingPlatformWindows.c` is made simple (just return `NULL`) such that it's very explicit type profiling isn't supported.

To elaborate on why current type profiling implementation doesn't work under MSVC ABI
* Under MSVC ABI, the name of the vtable variable is not necessarily the mangled name.  Take https://gcc.godbolt.org/z/drs1n9qd5 as an example, `@0`, `@1` and `@2` are vtables. 
* For instrumentation && profile collection under Itanium ABI, the vtables' mangled names (and its MD5hash) are used to map profiled runtime address to actual vtable variables.

As the godbolt example shows, the MSVC mangled name is still in the IR (just not vtable's variable name). I added some comments.

[1] diff in https://gist.github.com/minglotus-6/9df208e14f7c20b352cdb7f89d38c228


https://github.com/llvm/llvm-project/pull/82711


More information about the llvm-commits mailing list