[PATCH] D114383: [InstrProfiling] Add -runtime-counter-relocation=function mode

Roland McGrath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 30 10:43:17 PST 2021


mcgrathr marked an inline comment as done.
mcgrathr added a comment.

In D114383#3160468 <https://reviews.llvm.org/D114383#3160468>, @phosek wrote:

> An alternative I thought of would be to always use a call and generate a (weak) implementation of `__llvm_profile_counter_dynamic_bias` inside each translation unit. The default generated function would simply return the variable. I'm not sure what the impact on performance would be though.

I think the impact is likely to be significant in any place that the function is not inlined.  It's not just the call/return overhead per se (which might well be in the noise), but it also requires immediately spilling all the argument registers in the prologue because the calling convention for the bias fetch will clobber all those registers.  Without LTO, I don't think there's any possibility for a "weak inlined" definition, since inlining needs to happen early in compilation and weak vs strong definitions are not resolved one way or another until link time.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114383/new/

https://reviews.llvm.org/D114383



More information about the llvm-commits mailing list