@@ -462,18 +462,12 @@ struct GlobalStructInference : public Pass {
462
462
// the early return above) so that only leaves 1 and 2.
463
463
if (values.size () == 1 ) {
464
464
// The case of 1 value is simple: trap if the ref is null, and
465
- // otherwise return the value. We must also fence if the get was
466
- // seqcst. No additional work is necessary for an acquire get because
467
- // there cannot have been any writes to this immutable field that it
468
- // would synchronize with.
469
- Expression* replacement =
470
- builder.makeDrop (builder.makeRefAs (RefAsNonNull, curr->ref ));
471
- if (curr->order == MemoryOrder::SeqCst) {
472
- replacement =
473
- builder.blockify (replacement, builder.makeAtomicFence ());
474
- }
475
- replaceCurrent (
476
- builder.blockify (replacement, getReadValue (values[0 ])));
465
+ // otherwise return the value. Since the field is immutable, there
466
+ // cannot have been any writes to it we must synchonize with, so we do
467
+ // not need a fence.
468
+ replaceCurrent (builder.makeSequence (
469
+ builder.makeDrop (builder.makeRefAs (RefAsNonNull, curr->ref )),
470
+ getReadValue (values[0 ])));
477
471
return ;
478
472
}
479
473
assert (values.size () == 2 );
@@ -499,16 +493,10 @@ struct GlobalStructInference : public Pass {
499
493
// of their execution matters (they may note globals for un-nesting).
500
494
auto * left = getReadValue (values[0 ]);
501
495
auto * right = getReadValue (values[1 ]);
502
- // Note that we must trap on null, so add a ref.as_non_null here. We
503
- // must also add a fence if this get is seqcst. As before, no extra work
504
- // is necessary for an acquire get because there cannot be a write it
505
- // synchronizes with.
496
+ // Note that we must trap on null, so add a ref.as_non_null here. As
497
+ // before, the get cannot have synchronized with anything.
506
498
Expression* getGlobal =
507
499
builder.makeGlobalGet (checkGlobal, wasm.getGlobal (checkGlobal)->type );
508
- if (curr->order == MemoryOrder::SeqCst) {
509
- getGlobal =
510
- builder.makeSequence (builder.makeAtomicFence (), getGlobal);
511
- }
512
500
replaceCurrent (builder.makeSelect (
513
501
builder.makeRefEq (builder.makeRefAs (RefAsNonNull, curr->ref ),
514
502
getGlobal),
0 commit comments