[PATCH] D76802: [InstrProfiling] Use !associated metadata for counters, data and values

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 21 23:43:45 PST 2021


phosek added a comment.

In D76802#2201170 <https://reviews.llvm.org/D76802#2201170>, @pcc wrote:

> In D76802#2201164 <https://reviews.llvm.org/D76802#2201164>, @phosek wrote:
>
>> In D76802#2200926 <https://reviews.llvm.org/D76802#2200926>, @pcc wrote:
>>
>>> In D76802#2200906 <https://reviews.llvm.org/D76802#2200906>, @phosek wrote:
>>>
>>>> @davidxl does this look good to you? This feature is now gated on `-counter-associated-metadata` flag (I'd welcome suggestions for better name if you have some) because we require recent lld. We might be able to set that flag in the frontend when we know that the latest lld is being used in the future.
>>>
>>> Can you find a better way of communicating this infomation than via an `llvm::cl` flag (e.g. use a function attribute)? The flag won't be compatible with LTO.
>>
>> Do I understand your suggestion correctly that we would set function attribute when `-fprofile-*-generate -fuse-lld` is used that would enable the use of metadata in the backend?
>
> Yes, that's what I had in mind.

I was thinking that maybe a better approach would be to provide a new flag akin to `-fbinutils-version` introduced D85474 <https://reviews.llvm.org/D85474>, for example `-flld-version`. We would then emit the metadata unconditionally. In the backend, we would then check if LLD version is greater than 12 or if binutils version is greater than 2.36, and if not we would avoid using `SHF_LINK_ORDER` in this case effectively ignoring the metadata. During LTO, LLD would pass its own version to the backend via `TargetOptions`. WDYT?


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

https://reviews.llvm.org/D76802



More information about the llvm-commits mailing list