Take fields into account checking for self-assign
authorJoseph Tremoulet <jotrem@microsoft.com>
Tue, 28 Mar 2017 18:56:27 +0000 (14:56 -0400)
committerJoseph Tremoulet <jotrem@microsoft.com>
Wed, 29 Mar 2017 18:36:00 +0000 (14:36 -0400)
commitbc856a428e4c063dffde9fa52487ecba82b3e36d
tree0f1936af3a1986f0d01e870f2ecb4d47178f720a
parentc9136eba336d58e4e1637c5f6e29a41e3426b9d9
Take fields into account checking for self-assign

The code in `fgMorphCopyBlock` that removes self-assigns checks if the LHS
and RHS refer to the same `lclVar`; update it to also check if the LHS and
RHS refer to the same field(s) of that `lclVar`, since otherwise copies
from one field to another of a struct can get lost.

Fixes dotnet/coreclr#10481.

Commit migrated from https://github.com/dotnet/coreclr/commit/c3610d32da61d995191d77b91735b462b46a516a
src/coreclr/src/jit/morph.cpp
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_10481/GitHub_10481.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_10481/GitHub_10481.csproj [new file with mode: 0644]