diff options
author | Ellis Hoag <ellis.sparky.hoag@gmail.com> | 2023-08-04 11:26:14 -0700 |
---|---|---|
committer | Ellis Hoag <ellis.sparky.hoag@gmail.com> | 2023-08-07 10:15:08 -0700 |
commit | fe051934cbb0aaf25d960d7d45305135635d650b (patch) | |
tree | 8f168ed70ecb3bb7967ee78cfc3279c4aabc6b7a /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 165f7f06a125d072574b74ca5540b4e6141b5b7b (diff) | |
download | llvm-fe051934cbb0aaf25d960d7d45305135635d650b.zip llvm-fe051934cbb0aaf25d960d7d45305135635d650b.tar.gz llvm-fe051934cbb0aaf25d960d7d45305135635d650b.tar.bz2 |
[InstrProf] Encode linkage names in IRPGO counter names
Prior to this diff, names in the `__llvm_prf_names` section had the format `[<filepath>:]<function-name>`, e.g., `main.cpp:foo`, `bar`. `<filepath>` is used to discriminate between possibly identical function names when linkage is local and `<function-name>` simply comes from `F.getName()`. This has two problems:
* `:` is commonly found in Objective-C functions so that names like `main.mm:-[C foo::]` and `-[C bar::]` are difficult to parse
* `<function-name>` might be different from the linkage name, so it cannot be used to pass a function order to the linker via `-symbol-ordering-file` or `-order_file` (see https://discourse.llvm.org/t/rfc-temporal-profiling-extension-for-irpgo/68068)
Instead, this diff changes the format to `[<filepath>;]<linkage-name>`, e.g., `main.cpp;_foo`, `_bar`. The hope is that `;` won't realistically be found in either `<filepath>` or `<linkage-name>`.
To prevent invalidating all prior IRPGO profiles, we also lookup the prior name format when a record is not found (see `InstrProfSymtab::create()`, `readMemprof()`, and `getInstrProfRecord()`). It seems that Swift and Clang FE-PGO rely on the original `getPGOFuncName()`, so we cannot simply replace it.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D156569
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions