JIT: modify how jit determines when to update a type (dotnet/coreclr#22618)
authorAndy Ayers <andya@microsoft.com>
Fri, 15 Feb 2019 22:39:33 +0000 (14:39 -0800)
committerGitHub <noreply@github.com>
Fri, 15 Feb 2019 22:39:33 +0000 (14:39 -0800)
commitee8586010263e016b018809f6adcbd2b21a02c41
tree212231773eecfef840ac54fcaae9d319a883a9eb
parent8777faba2cb5d892628b89321f0daefe25d6d769
JIT: modify how jit determines when to update a type (dotnet/coreclr#22618)

For single-def locals, the type of a reference seen at the assignment to the
local may be a more specific type than the local's declared type. If so the jit
would prefer to use the assignment type to describe the local's value, as this
will lead to better optimization. For instance in
```
    object x = "a string";  // only assignment to x
```
the jit can optimize better if it models the type of `x` as `string`.

Instead of relying on `mergeClasses` plus some jit-side screening to decide if
the assignment type is a more specific type, implement a new jit interface
method `isMoreSpecificType` that tries to answer this question more directly.

Added a test case with type equivalence that hit asserts.

Closes dotnet/coreclr#22583.

Commit migrated from https://github.com/dotnet/coreclr/commit/bb62718325435a1ad5761c84c06b8b653856e296
20 files changed:
src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h
src/coreclr/src/ToolBox/superpmi/superpmi-shared/lwmlist.h
src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.h
src/coreclr/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp
src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
src/coreclr/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
src/coreclr/src/inc/corinfo.h
src/coreclr/src/jit/lclvars.cpp
src/coreclr/src/vm/jitinterface.cpp
src/coreclr/src/vm/jitinterface.h
src/coreclr/src/zap/zapinfo.cpp
src/coreclr/src/zap/zapinfo.h
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_22583/GitHub_22583.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_22583/GitHub_22583.csproj [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_22583/base.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_22583/base.csproj [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_22583/lib.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_22583/lib.csproj [new file with mode: 0644]