Fix fast tail call lowering bug.
authorEugene Rozenfeld <erozen@microsoft.com>
Fri, 9 Jun 2017 18:05:48 +0000 (11:05 -0700)
committerEugene Rozenfeld <erozen@microsoft.com>
Fri, 9 Jun 2017 18:41:25 +0000 (11:41 -0700)
commit64647881827fa4a57736cd243710932036229a8c
tree7d59b2e3c7a000ac033c0f4db091f316545cdd36
parent206e79850e2b79a211c0f65d5bfbb58ef0c53c62
Fix fast tail call lowering bug.

Lowering::LowerFastTailCall has code that handles the case when the caller and the callee both have parameters
passed on the stack and the callee has register arguments that are computed from the caller's stack-passed arguments.
In that case the stack arguments of the callee are set up in the caller's incoming argument area so they override
the caller's arguments. Lowering::LowerFastTailCall creates temps for any caller's arguments passed on the stack that are
used to compute callee's register arguments. That code had a bug where it was converting GT_LCL_FLD nodes into
GT_LCL_VAR nodes. That's problematic both for the case of a single-field struct with a double field and for multi-field structs.
In the former case we were getting LSRA asserts in checked builds and SBCG in release builds. In the latter case we were getting SBCG
both in checked and release builds.

The fix is not to convert GT_LCL_FLD nodes into GT_LCL_VAR nodes and mark the new temps as not-enregisterable if the
local is not-enregisterable.

An alternative fix would be to create multiple register temps for each GT_LCL_FLD or GT_LCL_VAR targeting the local but that
would complicate the code and I decided to go with a simlper solution for this uncommon case.

Commit migrated from https://github.com/dotnet/coreclr/commit/c1bac92bcba5f3c9af08ba5088aa27c264d23f37
src/coreclr/src/jit/lower.cpp
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_12037/GitHub_12037.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_12037/GitHub_12037.csproj [new file with mode: 0644]