diff options
Diffstat (limited to 'src/ir/effects.h')
-rw-r--r-- | src/ir/effects.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ir/effects.h b/src/ir/effects.h index 716624d64..ee596f67b 100644 --- a/src/ir/effects.h +++ b/src/ir/effects.h @@ -872,6 +872,18 @@ private: if (curr->ref->type.isNullable()) { parent.implicitTrap = true; } + switch (curr->order) { + case MemoryOrder::Unordered: + break; + case MemoryOrder::SeqCst: + // Synchronizes with other threads. + parent.isAtomic = true; + break; + case MemoryOrder::AcqRel: + // Only synchronizes if other threads can read the field. + parent.isAtomic = curr->ref->type.getHeapType().isShared(); + break; + } } void visitStructSet(StructSet* curr) { if (curr->ref->type.isNull()) { @@ -883,6 +895,9 @@ private: if (curr->ref->type.isNullable()) { parent.implicitTrap = true; } + if (curr->order != MemoryOrder::Unordered) { + parent.isAtomic = true; + } } void visitArrayNew(ArrayNew* curr) {} void visitArrayNewData(ArrayNewData* curr) { |