From ee1f131e70854ec4b5dec172521c6d26dfc33d34 Mon Sep 17 00:00:00 2001 From: Mike Danes Date: Sun, 25 Nov 2018 10:44:31 +0200 Subject: [PATCH] Add test for 18867 Commit migrated from https://github.com/dotnet/coreclr/commit/8cfbd3381e658485477522ba47d00e19057e0d72 --- .../JitBlue/GitHub_18867/GitHub_18867.cs | 69 ++++++++++++++++++++++ .../JitBlue/GitHub_18867/GitHub_18867.csproj | 17 ++++++ 2 files changed, 86 insertions(+) create mode 100644 src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_18867/GitHub_18867.cs create mode 100644 src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_18867/GitHub_18867.csproj diff --git a/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_18867/GitHub_18867.cs b/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_18867/GitHub_18867.cs new file mode 100644 index 0000000..ef5fd73 --- /dev/null +++ b/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_18867/GitHub_18867.cs @@ -0,0 +1,69 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.CompilerServices; + +interface IRT +{ + void WriteLine(T val); +} + +class CRT : IRT +{ + public static object line; + public void WriteLine(T val) => line = val; +} + +public class Program +{ + static IRT s_rt; + static byte[] s_1 = new byte[] { 0 }; + static int s_3; + static short[] s_8 = new short[] { -1 }; + + public static int Main() + { + s_rt = new CRT(); + M11(s_8, 0, 0, 0, true, s_1); + return ((int)CRT.line == -1) ? 100 : 1; + } + + // Test case for a lvNormalizeOnLoad related issue in assertion propagation. + // A "normal" lclvar is substituted with a "normalize on load" lclvar (arg3), + // that results in load normalization being skipped. + + [MethodImpl(MethodImplOptions.NoInlining)] + static ushort M11(short[] arg0, ushort arg1, short arg3, byte arg4, bool arg7, byte[] arg10) + { + if (arg7) + { + ulong var4 = (ulong)s_3; + + // mov edi, gword ptr [classVar[0x2c44174]] + // cmp dword ptr [edi + 4], 0 + // jbe SHORT G_M17557_IG06 + // movsx edi, word ptr [edi + 8] + // mov word ptr [ebp + 14H], di ; word only store + arg3 = s_8[0]; + + short var5 = arg3; + s_rt.WriteLine(var4); + + // call CORINFO_HELP_VIRTUAL_FUNC_PTR + // mov ecx, edi + // mov edx, dword ptr [ebp + 14H] ; dword load, no sign extension + // call eax + s_rt.WriteLine((int)var5); + } + + if (!arg7) + { + var vr7 = arg0[0]; + } + + arg10[0] = arg4; + return arg1; + } +} diff --git a/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_18867/GitHub_18867.csproj b/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_18867/GitHub_18867.csproj new file mode 100644 index 0000000..d86ed9f --- /dev/null +++ b/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_18867/GitHub_18867.csproj @@ -0,0 +1,17 @@ + + + + + Release + AnyCPU + $(MSBuildProjectName) + Exe + + True + + + + + + + \ No newline at end of file -- 2.7.4