Skip to content

Commit bf80e0e

Browse files
authored
JIT: Avoid VN-based removal of dead byref store in async funcs (#116136)
1 parent ca376e3 commit bf80e0e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/coreclr/jit/optimizer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5851,6 +5851,14 @@ PhaseStatus Compiler::optVNBasedDeadStoreRemoval()
58515851
continue;
58525852
}
58535853

5854+
if (compIsAsync() && ((varDsc->TypeGet() == TYP_BYREF) ||
5855+
((varDsc->TypeGet() == TYP_STRUCT) && varDsc->GetLayout()->HasGCByRef())))
5856+
{
5857+
// A dead store to a byref local may not actually be dead if it
5858+
// crosses a suspension point.
5859+
continue;
5860+
}
5861+
58545862
for (unsigned defIndex = 1; defIndex < defCount; defIndex++)
58555863
{
58565864
LclSsaVarDsc* defDsc = varDsc->lvPerSsaData.GetSsaDefByIndex(defIndex);

0 commit comments

Comments
 (0)