[PATCH] D99434: [TSAN] Honor acquire failure mode on AtomicCAS

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 09:38:47 PDT 2021


yln accepted this revision.
yln added a comment.
This revision is now accepted and ready to land.

I am happy with the mechanics and quality of the patch.  Ideally @dvyukov could give a final sign-off.



================
Comment at: compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp:433
+  // Honor failure memory order.
+  CHECK(IsLoadOrder(fmo));
+  if (fmo != mo_acquire)
----------------
delcypher wrote:
> Is this something user facing code can set? If yes, then we might want to emit a warning rather than crashing the process.
I think calls are generated by the compiler in `ThreadSanitizer::instrumentAtomic()`:
```
    Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy),
                     CmpOperand,
                     NewOperand,
                     createOrdering(&IRB, CASI->getSuccessOrdering()),
                     createOrdering(&IRB, CASI->getFailureOrdering())};
    CallInst *C = IRB.CreateCall(TsanAtomicCAS[Idx], Args);
```


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

https://reviews.llvm.org/D99434



More information about the llvm-commits mailing list