Fix for a bug in tail recursion elimination.
authorEugene Rozenfeld <erozen@microsoft.com>
Tue, 11 Jul 2017 08:03:26 +0000 (01:03 -0700)
committerEugene Rozenfeld <erozen@microsoft.com>
Tue, 11 Jul 2017 08:22:04 +0000 (01:22 -0700)
commitaeecbffb1d115924e758fee4d852aeabd6b94852
treed64da7518f60d86a781911f28fa0ddfb43ee8540
parentd8b212f3190bedac609bf822638561e515694a93
Fix for a bug in tail recursion elimination.

Tail recursion elimination transforms a tail call into a loop.
If compInitMem is set, we may need to zero-initialize some locals. Normally it's done in the prolog
but the loop we are creating can't include the prolog. The fix is to insert zero-initialization
for all non-parameter non-temp locals in the loop. Liveness phase will remove unnecessary initializations.

We never hit this case with normal C# code since C# definite assignment rules ensure that there are
no uninitialized locals in the generated msil. In the repro the method with tail recursion is a dynamic method
and it has an uninitialized local.
src/jit/morph.cpp
tests/src/JIT/Regression/JitBlue/DevDiv_461649/DevDiv_461649.cs [new file with mode: 0644]
tests/src/JIT/Regression/JitBlue/DevDiv_461649/DevDiv_461649.csproj [new file with mode: 0644]
tests/src/JIT/Regression/JitBlue/DevDiv_461649/Input.xml [new file with mode: 0644]
tests/src/JIT/Regression/JitBlue/DevDiv_461649/Transform.xsl [new file with mode: 0644]