Fix issue dotnet/coreclr#11446. (dotnet/coreclr#11455)
authorPat Gavlin <pgavlin@gmail.com>
Tue, 9 May 2017 18:10:00 +0000 (11:10 -0700)
committerGitHub <noreply@github.com>
Tue, 9 May 2017 18:10:00 +0000 (11:10 -0700)
commit4ac6a2ead5e8c5c6c2e2eb9511d3cb8af75569cc
treefe1e17ab8057508cef8aefa3facc2b8cc578e268
parent16445a6b5ba7374ae503b5b511f40bf648cce24d
Fix issue dotnet/coreclr#11446. (dotnet/coreclr#11455)

This issue was a GC hole that was caused by bad IR produced by
recursivelty promoting a struct with the following form:

```
struct S
{
    struct T
    {
        object o;
    };

    T t;
}
```

In this case, the recursive promotion logic created a single lclVar to
represent `S.t` and retyped it using the type of `T.o`, but did not
rewrite IR that treated the single lclVar as a struct (e.g. instances of
`lclFld/st.lclFld Vx` where `Vx` referred to the lclVar that represented
`S.t` were not rewritten an `lclVar/st.lclVar Vx`). This IR in
turn confused the incremental liveness used during code generation,
which caused the stack slot holding `o`'s value to die too early.

This change fixes codegen's incremental liveness to handle this case.

Commit migrated from https://github.com/dotnet/coreclr/commit/4f6fe878d7dfe2a148252eecc672981eedda1f1c
src/coreclr/src/jit/codegenlinear.cpp
src/coreclr/src/jit/codegenxarch.cpp