[llvm] [Coverage] Fix atomic mode for certain types of coverage counter updates (PR #204597)

Roman Beliaev via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 06:00:19 PDT 2026


================
@@ -1253,7 +1253,9 @@ void InstrLowerer::lowerCover(InstrProfCoverInst *CoverInstruction) {
   }
 
   // We store zero to represent that this block is covered.
-  Builder.CreateStore(Builder.getInt8(0), Addr);
+  StoreInst *Store = Builder.CreateStore(Builder.getInt8(0), Addr);
+  if (Options.Atomic || AtomicCounterUpdateAll)
+    Store->setOrdering(llvm::AtomicOrdering::Monotonic);
----------------
belyaevrd wrote:

Add this in `llvm/test/Instrumentation/InstrProfiling/mcdc.ll`.

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


More information about the llvm-commits mailing list