Fix incorrect compare narrowing in TreeNodeInfoInitCmp
authorMike Danes <onemihaid@hotmail.com>
Tue, 13 Dec 2016 12:45:13 +0000 (14:45 +0200)
committerMike Danes <onemihaid@hotmail.com>
Tue, 13 Dec 2016 17:12:56 +0000 (19:12 +0200)
commit70d72b50a501bae4bb561e911dddc5734d6b8943
treec0c01140fc9a5628b5378488d0da6b75dfe64377
parent794feca720e13774e01f16bf78bfb2a26c42e64e
Fix incorrect compare narrowing in TreeNodeInfoInitCmp

TreeNodeInfoInitCmp attempts to eliminate the cast from
`cmp(cast<ubyte>(x), icon)` by narrowing the compare to ubyte. This should
only happen if the constant fits in a byte so it can be narrowed too,
otherwise codegen produces an int sized compare. (or a byte sized compare
with a truncated constant if we try to use GTF_RELOP_SMALL).

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