JIT: optimize some cases of unused structs (dotnet/coreclr#18819)
authorAndy Ayers <andya@microsoft.com>
Fri, 13 Jul 2018 20:21:27 +0000 (13:21 -0700)
committerGitHub <noreply@github.com>
Fri, 13 Jul 2018 20:21:27 +0000 (13:21 -0700)
commit8cf900611b5ac943c61871b582d8465750d15f8f
treea14ab329cdcd7fee912fb4ea990219dfba2d9c1e
parent694a95dfce32b11efe84085a60cd1f24e6061560
JIT: optimize some cases of unused structs (dotnet/coreclr#18819)

In some cases CSC will use `ldobj; pop` to null check a pointer to
struct. This change avoids copying the struct value for such constructs.

Codegen may still redundantly null check, if there are multiple such checks
in a method.

Fixes dotnet/coreclr#18710

Commit migrated from https://github.com/dotnet/coreclr/commit/dc7492e227f0ff1a5054337091c5ce7105e82491
src/coreclr/src/jit/importer.cpp
src/coreclr/tests/src/JIT/opt/Structs/structpop.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/opt/Structs/structpop.csproj [new file with mode: 0644]
src/coreclr/tests/src/JIT/opt/Structs/structpop2.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/opt/Structs/structpop2.csproj [new file with mode: 0644]