[release/6.0] Add cast when replacing promoted struct with field in lowering (#58951)
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Fri, 10 Sep 2021 18:07:30 +0000 (11:07 -0700)
committerGitHub <noreply@github.com>
Fri, 10 Sep 2021 18:07:30 +0000 (11:07 -0700)
commit9f2e4ace08d96eb5a43d55f05a5c92776009443e
tree8fe63eb5b059bdc01807727c0fd8f93972c98a3f
parent8bfc0302a28bd94fe5078d9ea489b6a8bc8978ee
[release/6.0] Add cast when replacing promoted struct with field in lowering (#58951)

* Add cast when replacing promoted struct with field in lowering

We may need to sign/zero-extend when we do this replacement very late.
Normally this cast would be inserted in morph.

Fix #58373

* Add test

* Fix formatting

* Fix test cases

* Type returned-struct-as-primitive correctly for normalization

Retyping it to the type of the ret node is not right when reinterpreting
small structs as a type that needs to be normalized.

* Fix assertion

* Run jit-format

Co-authored-by: Jakob Botsch Nielsen <jakob.botsch.nielsen@gmail.com>
src/coreclr/jit/lower.cpp
src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_1.cs [new file with mode: 0644]
src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_1.csproj [new file with mode: 0644]
src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_2.cs [new file with mode: 0644]
src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_2.csproj [new file with mode: 0644]