Fix assert 'treeWithCall == call' (#2050)
authorBruce Forstall <brucefo@microsoft.com>
Thu, 23 Jan 2020 19:56:20 +0000 (11:56 -0800)
committerGitHub <noreply@github.com>
Thu, 23 Jan 2020 19:56:20 +0000 (11:56 -0800)
commit19dd8d171262f6df60703b23d2439273792be9ec
treed6fb60ff15080c640b2bf660230c5fc8dbce7891
parent98f58b78915e6599d16a8e6767decbc0a7941b4f
Fix assert 'treeWithCall == call' (#2050)

* Fix assert 'treeWithCall == call'

This assert was occurring when we have:
- a potential optimistic tail call
- of a function that returns a ref type
- that is also an inline candidate
- whose inline is rejected
- with `COMPlus_JitGCChecks` stress mode that injects a
call to `CORINFO_HELP_CHECK_OBJ` at the `RETURN`
- where we decide to go ahead with the optimistic tailcall
but it is no longer in legal tailcall position.

To fix, simply disallow a tailcall if we are doing
`COMPlus_JitGCChecks` in a function with a ref type return, that
would have inserted the problemmatic call.

Fixes #1821

* Fix formatting
src/coreclr/src/jit/morph.cpp