[PATCH] D57854: [InstCombine] Optimize `atomicrmw <op>, 0` into `load atomic` when possible

JF Bastien via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 7 10:31:25 PST 2019


jfb added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp:39
+           Ordering != AtomicOrdering::Unordered &&
+           "AtomicRMWs don't make sense with Unordered or NotAtomic");
+    if (Ordering != AtomicOrdering::Acquire &&
----------------
qcolombet wrote:
> jfb wrote:
> > Agreed NotAtomic is bonkers (`AtomicRMWInst::Init` disallows it), but Unordered might be sensible, @reames would know.
> From the language reference (http://llvm.org/docs/LangRef.html#atomic-memory-ordering-constraints):
> Unordered
> [...]
> This ordering cannot be specified for read-modify-write operations; it is not strong enough to make them atomic in any interesting way.
> 
> And if I try to write a test case with unordered I get:
> error: atomicrmw cannot be unordered
> 
> So I think we are good :).
I did not know this! Ignore me then.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D57854





More information about the llvm-commits mailing list