Skip to content

Commit 467e23f

Browse files
JIT: Fix invalid memory barrier removal optimization (#91870)
The ARM32/ARM64 backends have an optimization where they optimize out the latter of two subsequent memory barriers if no memory store/load has been seen between them. This optimization should not be allowed to remove memory barriers when a call has been seen. Fix #91732 Co-authored-by: Jakob Botsch Nielsen <[email protected]>
1 parent 49b266d commit 467e23f

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/coreclr/jit/emitarm.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4850,6 +4850,7 @@ void emitter::emitIns_Call(EmitCallType callType,
48504850

48514851
dispIns(id);
48524852
appendToCurIG(id);
4853+
emitLastMemBarrier = nullptr; // Cannot optimize away future memory barriers
48534854
}
48544855

48554856
/*****************************************************************************

src/coreclr/jit/emitarm64.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8886,6 +8886,7 @@ void emitter::emitIns_Call(EmitCallType callType,
88868886

88878887
dispIns(id);
88888888
appendToCurIG(id);
8889+
emitLastMemBarrier = nullptr; // Cannot optimize away future memory barriers
88898890
}
88908891

88918892
/*****************************************************************************

0 commit comments

Comments
 (0)