[llvm-branch-commits] [llvm] [Inline][PGO] After inline, update profile for invoke instruction in both cloned instruction in the caller and original callee (PR #83809)

Mingming Liu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Mar 5 13:01:36 PST 2024


minglotus-6 wrote:

> The invoke instruction can have 3 different kinds of prof data
> 
> 1. call count (if a direct call)
> 2. VP profile data (if an indirect call)
> 3. branch weights for landing pad.
> 4. can coexist with  2) and does not need to be updated.

thanks for the list. I get the point that 1 and 2 are mutually exclusive. For my understanding, which one out of {1, 2, 3} doesn't need to be updated?

>  Is there an existing test coverage for type 1) update?

Searching under `Transforms/Inline` directory, [inline-hot-callsite.ll](https://github.com/llvm/llvm-project/blob/4a4fb930a539c91eb4e9d8b1ea427a7cef72d054/llvm/test/Transforms/Inline/inline-hot-callsite.ll#L61) is an existing test with `!prof` annotated `invoke`, but the type is 3 (branch weights) not 1 (call count). 

Meanwhile, non-call instructions could have branch weights (notably `SwitchInst` and `IndirectBrInst`), and https://gcc.godbolt.org/z/8jjjPEcao shows '!prof' for 'switch' isn't updated after inline. I'll probably add the 'switch' test case together with the `callbr` [test case ](https://gcc.godbolt.org/z/b36P8o3K1).

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


More information about the llvm-branch-commits mailing list