Consolidate importer spilling code V2 (#72744)
authorSingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
Tue, 26 Jul 2022 19:30:12 +0000 (22:30 +0300)
committerGitHub <noreply@github.com>
Tue, 26 Jul 2022 19:30:12 +0000 (12:30 -0700)
commitcea17b2ac2886a154aa813bcfa2fac386ed9f10a
treea72a38483ff66548fccbb72b012ce3650100cde6
parent39d82c99b44db470f43fc12498c1aec082e5c6e2
Consolidate importer spilling code V2 (#72744)

* Consolidate importer spilling code (#72291)

* Add tests

* Fix losing GLOB_REF on the LHS

The comment states we don't need it, which is incorrect.

Diffs are improvements because we block forward substitution of
calls into "ASG(BLK(ADDR(LCL_VAR<field>, ...)))", which allows
morph to leave the "can be replaced with its field" local alone.

* Prospective fix

Spill "glob refs" on stores to "aliased" locals.

* Delete now-not-necessary code

* Fix up asserts

* Clean out '(unsigned)CHECK_SPILL_ALL/NONE' casts

* Don't manually spill for 'st[s]fld'

* Revert 'Clean out '(unsigned)CHECK_SPILL_ALL/NONE' casts'

* Fix assignments done via return buffers

The mistake in logic was that the only trees which could modify
unaliased locals are assignments, which is not true, calls can
do that as well.

One day we will move the return buffer handling out of importer,
but until then, special handling is required.

An alternative fix would have been to bring back the explicit
"impSpillLclRefs" to "stloc/starg" code, but that would contradict
the overall goal of consolidating the spilling logic.
src/coreclr/jit/compiler.h
src/coreclr/jit/importer.cpp
src/tests/JIT/Regression/JitBlue/Runtime_72133/Runtime_72133.il [new file with mode: 0644]
src/tests/JIT/Regression/JitBlue/Runtime_72133/Runtime_72133.ilproj [new file with mode: 0644]