[lld] [compiler-rt] [llvm] [InstrProf] No linkage prefixes in IRPGO names (PR #76994)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 14:46:15 PST 2024


ellishg wrote:

> Just to confirm my understanding, will the profile data flow be something like this with this approach?
> 
>     * raw profiles -> `llvm-profdata order` -> `<new-post-processing> which does rename by combining linkage information` -> output used in `-order_file`

Yes. In fact, I have a small python script that does this where `all_symbols` comes from `nm -pU <binary> | cut -d' ' -f3-` and `ordered_symbols` comes from `llvm-profdata order <profile>`.
```python
fixed_ordered_symbols = [
    next(
        (
            prefix + symbol
            for prefix in ["", "_", "l_"]
            if prefix + symbol in all_symbols
        ),
        symbol,
    )
    for symbol in ordered_symbols
]
```

I'd also like to automatically order functions at build time when the profile is passed with `-fprofile-generate`. I think I'll need to do some processing to make sure the names are properly passed to the linker.

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


More information about the llvm-commits mailing list