[PATCH] D152328: InstrProf - don't emit 64 bit atomic operations on 32 bit platforms

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 20 21:39:52 PDT 2023


davidxl added a comment.

In D152328#4436433 <https://reviews.llvm.org/D152328#4436433>, @SeanMollet wrote:

> In D152328#4436425 <https://reviews.llvm.org/D152328#4436425>, @ellis wrote:
>
>> I still don't see how `DoCounterPromotion=true` emits atomics. As far as I can tell, all atomic instructions emitted in `InstrProfiling.cpp` are guarded behind an atomic flag that defaults to false.
>
> I honestly couldn't figure it out either. If I change that to =false or comment that line out, they don't get emitted. Somehow AtomicCounterUpdatePromoted is getting set to true.
>
> The offending emitter is InstrProfiling.cpp line 198:
>
>   Builder.CreateAtomicRMW(AtomicRMWInst::Add, Addr, LiveInValue,
>                           MaybeAlign(),
>                           AtomicOrdering::SequentiallyConsistent);

This is guarded by option atomic-counter-update-promoted option which is false by default. Can you debug your build see how it is set to true?

> I added the check around line 743 as well for sanity reasons.




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

https://reviews.llvm.org/D152328



More information about the llvm-commits mailing list