Fix for bug 20499.
authorEugene Rozenfeld <erozen@microsoft.com>
Sat, 10 Nov 2018 00:53:49 +0000 (16:53 -0800)
committerEugene Rozenfeld <erozen@microsoft.com>
Wed, 14 Nov 2018 03:05:42 +0000 (19:05 -0800)
commit972a4e64d5862fd324cfe023bd0914ca80f51cd0
treee5038a63d9afd018a6dd559fb8c26a1b00edffbd
parent27c1eb3d81e6f5615f9eb2b1b53f57c353ecc68f
Fix for bug 20499.

When the jit is copying a struct-typed return to the return local in a synchronous method on arm64,
it ends up invoking an importer utility outside the importer, where impTreeLast is not set.

The call sequence is
fgMorphBlocks --> gtNewTempAssign --> impAssignStruct --> impAssignStructPtr --> impAppendTree

When impAssignStructPtr sees GT_COMMA src nodes, it unwraps them and inserts additional statements.
The fix is to pass an insertion point statement through this call chain to prevent impAssignStruct
and impAssignStructPtr from calling impAppendTree outside of the importer.

Commit migrated from https://github.com/dotnet/coreclr/commit/73f84776b9db118f855672724388cb1def3f2906
src/coreclr/src/jit/compiler.h
src/coreclr/src/jit/gentree.cpp
src/coreclr/src/jit/importer.cpp
src/coreclr/src/jit/morph.cpp
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_20499/GitHub_20499.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_20499/GitHub_20499.csproj [new file with mode: 0644]