JIT: fix case where RBO leads to an invalid CSE (#88159)
authorAndy Ayers <andya@microsoft.com>
Thu, 29 Jun 2023 19:46:59 +0000 (12:46 -0700)
committerGitHub <noreply@github.com>
Thu, 29 Jun 2023 19:46:59 +0000 (12:46 -0700)
commitbba7a9c67e5b6728833bedbb368f732fb499bcc1
treef129096640b2719b360a9c3f123fcfe6ba4d20e5
parent5a24757eab72279dcc28f2359ef5771b279efc59
JIT: fix case where RBO leads to an invalid CSE (#88159)

If phi-based RBO bypasses a block with a memory PHI, it is possible for CSE to find
invalid memory-based CSEs. An example of this is seen in the attached test case.

Ideally perhaps CSE would kill availability of these CSEs at the point where memory
can change, but that seems difficult to arrange. Instead, we mark the bypased block
as one that will not propagate any incoming CSEs, as the failures we know of require
CSEs to flow back through this block.

Fixes #88091.
src/coreclr/jit/block.h
src/coreclr/jit/fgdiagnostic.cpp
src/coreclr/jit/jitconfigvalues.h
src/coreclr/jit/optcse.cpp
src/coreclr/jit/redundantbranchopts.cpp
src/tests/JIT/Regression/JitBlue/Runtime_88091/Runtime_88091.cs [new file with mode: 0644]
src/tests/JIT/Regression/JitBlue/Runtime_88091/Runtime_88091.csproj [new file with mode: 0644]