JIT: improve return types in cases with spill temps (#15766)
authorAndy Ayers <andya@microsoft.com>
Mon, 8 Jan 2018 16:44:14 +0000 (08:44 -0800)
committerGitHub <noreply@github.com>
Mon, 8 Jan 2018 16:44:14 +0000 (08:44 -0800)
commita76445568d42b9b7d37d9f6e94ec47393179585e
tree75f98c59bd35316eb527a6c46877a386524a92c0
parentd36b8e18fa0e1f81a176174e0413c368f2743297
JIT: improve return types in cases with spill temps (#15766)

If the jit sees that an inlinee has multiple return sites or has gc ref locals
it will choose to return the inline result via a temp. The jit was not assigning
a type to that temp and so losing track of some type information.

So, for inlinees returning ref types, initially type the return spill temp with
the declared return type of the method.

When importing we may discover that particular return sites will return more
specific types. If all discovered return sites agree, we can update the return
type for the spill temp to match the consensus improved type.

This can lead to removal of some type checks and also to devirtualization.

Addresses issues discussed in #9908 and #15743.
src/jit/compiler.cpp
src/jit/flowgraph.cpp
src/jit/importer.cpp
src/jit/inline.h
tests/src/JIT/opt/Devirtualization/spilledreturn.cs [new file with mode: 0644]
tests/src/JIT/opt/Devirtualization/spilledreturn.csproj [new file with mode: 0644]