[clang] [compiler-rt] [llvm] [compiler-rt][CSan] Add a minimal value-check configuration (PR #244727)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 23 20:47:13 PST 2026


================
@@ -442,9 +468,14 @@ bool ConcurrencySanitizer::instrumentLoadOrStore(Instruction *I,
                                                  const DataLayout &DL) {
   const bool IsWrite = isa<StoreInst>(I);
   Value *Addr = getLoadStorePointerOperand(I);
-  if (!insertAccessProbe(I, Addr, getLoadStoreType(I), DL, IsWrite,
-                         /*IsCompound=*/false, /*IsAtomic=*/false))
+  Type *AccessTy = getLoadStoreType(I);
+  if (ClMinimal) {
+    if (!insertTypedValueCheck(I, Addr, AccessTy, DL, IsWrite))
----------------
yxsamliu wrote:

With `-csan-distinguish-volatile` enabled, regular CSan emits `__csan_write4` with the atomic flag set. Minimal mode emits two volatile loads around `__csan_delay` before the store. If another thread changes the value between those loads, the comparison calls `__csan_report_race`, which is what I saw in the aligned-volatile test. Is the flag intended to apply only to regular CSan?

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


More information about the cfe-commits mailing list