[llvm] [PGO] Implement PGO counter promotion for atomic updates (PR #202487)
Wael Yehia via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 11 19:11:49 PDT 2026
================
@@ -117,6 +119,16 @@ cl::opt<bool> AtomicCounterUpdateAll(
cl::desc("Make all profile counter updates atomic (for testing only)"),
cl::init(false));
+cl::opt<bool> AtomicCounterPromote(
+ "atomic-counter-promote",
+ cl::desc("Atomize profile counter updates and promote where possible"),
----------------
w2yehia wrote:
yes, that flag was added by @david-xl in 2017, but I couldn't find the rationale for using seq_cst in the phabricator review.
Personally, I don't see the need for seq_cst since the PGO counter variables are independent of eachother and don't need to be sequenced w.r.t eachother. But I didn't want to change an existing behavior.
Also, that flag uses atomics for inner loop promoted candidates only, which I suspect is due to the limitation that the LoadStorePromoter and SSAUpdater don't know about AtomicRMW.
@david-xl do we need the update done with `atomic-counter-update-promoted` to be seq_cst instead of relaxed? Also do you have any feedback on this patch? Thanks
https://github.com/llvm/llvm-project/pull/202487
More information about the llvm-commits
mailing list