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)
commitc1bac92bcba5f3c9af08ba5088aa27c264d23f37
treea8cfde7c5114e4c33142c4146164101c2ba0b8d1
parent699b25847ec14e47abc03cf7f3a1ffdb249d68b6
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.
src/jit/lower.cpp
tests/src/JIT/Regression/JitBlue/GitHub_12037/GitHub_12037.cs [new file with mode: 0644]
tests/src/JIT/Regression/JitBlue/GitHub_12037/GitHub_12037.csproj [new file with mode: 0644]