Fix for bug 12398: Lowering is inconsistent in checking safety of RegOptional. (dotne...
authorEugene Rozenfeld <erozen@microsoft.com>
Fri, 7 Sep 2018 17:48:06 +0000 (10:48 -0700)
committerGitHub <noreply@github.com>
Fri, 7 Sep 2018 17:48:06 +0000 (10:48 -0700)
commitca23f5e7f30abcdb3885c62eb4100056d3f66063
treea31d0caad77445cc606f61fd8ce0894b096ee4c5
parent7fece3cfa5d569200fbf9b8c7aedf19c10c01472
Fix for bug 12398: Lowering is inconsistent in checking safety of RegOptional. (dotnet/coreclr#19740)

This fixes an inconsistency in lowering where it fails to make an
operand contained because IsSafeToContainMem() returns false yet
it marks it regOptional, which may cause a problem if the operand
will be loaded at the point of use.

I also fixed a case where an operand was marked RegOptional even though
there is a type size mismatch.

There are 7 places that are affected, I added repro cases for 4 of them.
I wasn't able to construct repros for the 3 places that deal with
floating point operands but decided to fix those places anyway.

Fixes dotnet/coreclr#12398.

Commit migrated from https://github.com/dotnet/coreclr/commit/36449cf94237e7cddb7e43a9fe6f873e7f5ebf77
src/coreclr/src/jit/lower.cpp
src/coreclr/src/jit/lower.h
src/coreclr/src/jit/lowerxarch.cpp
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_12398/Github_12398.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_12398/Github_12398.csproj [new file with mode: 0644]