diff options
author | Brian Sullivan <briansul@microsoft.com> | 2018-09-14 16:58:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-14 16:58:03 -0700 |
commit | 31c71908203752358dc69dbdf92d707528a8c8b4 (patch) | |
tree | 562395746fbbaa3d37f80c5ca25bd0d676f18821 /tests/src | |
parent | 7dcf572e8ae8de4a96a57d0cda62a173012d94eb (diff) | |
parent | 49d931cd534eb09654fb20c90fed70b4fa499886 (diff) | |
download | coreclr-31c71908203752358dc69dbdf92d707528a8c8b4.tar.gz coreclr-31c71908203752358dc69dbdf92d707528a8c8b4.tar.bz2 coreclr-31c71908203752358dc69dbdf92d707528a8c8b4.zip |
Merge pull request #19125 from mikedn/cse-extract
[WIP] Fix CSE side effect and definition extraction
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/JIT/Regression/JitBlue/GitHub_18770/GitHub_18770.cs | 116 | ||||
-rw-r--r-- | tests/src/JIT/Regression/JitBlue/GitHub_18770/GitHub_18770.csproj | 17 |
2 files changed, 133 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18770/GitHub_18770.cs b/tests/src/JIT/Regression/JitBlue/GitHub_18770/GitHub_18770.cs new file mode 100644 index 0000000000..fde882df11 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18770/GitHub_18770.cs @@ -0,0 +1,116 @@ +// 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; + +class Program +{ + static int Main() + { + return (Test1.Run() & Test2.Run() & Test3.Run()) ? 100 : -1; + } +} + +class Test1 +{ + class C0 + { + public sbyte F0; + public ushort F7; + public uint F8; + } + + static C0 s_1; + + public static bool Run() + { + s_1 = new C0(); + try + { + M0(); + return true; + } + catch (NullReferenceException) + { + return false; + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static void M0() + { +#pragma warning disable 1717, 1718 + bool vr0 = (s_1.F7 < s_1.F0) ^ (s_1.F8 != s_1.F8); + if (vr0) + { + s_1.F7 = s_1.F7; + } + } +} + +class Test2 +{ + class C0 + { + public long F0; + public C0(long f0) + { + F0 = f0; + } + } + + static char s_1; + static ulong s_2 = 1; + static int s_6; + static C0 s_7; + static C0 s_9 = new C0(-1L); + + public static bool Run() + { + s_6 = 0; + M1(); + return s_7.F0 == 0; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static void M1() + { + long vr1 = ((0 & (M2() + s_9.F0)) | s_1) / (long)s_2; + s_7 = s_9; + } + + static int M2() + { + s_9 = new C0(0); + return s_6; + } +} + +class Test3 +{ + public static bool Run() + { + try + { + M5(new ulong[0]); + return false; + } + catch (IndexOutOfRangeException) + { + return true; + } + catch (DivideByZeroException) + { + return false; + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static byte M5(ulong[] arg0) + { + int var0 = (ushort)((0 % arg0[0]) | (byte)(-32768 * (int)(0 & arg0[0]))); + return (byte)var0; + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18770/GitHub_18770.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_18770/GitHub_18770.csproj new file mode 100644 index 0000000000..d86ed9f3d7 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_18770/GitHub_18770.csproj @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <OutputType>Exe</OutputType> + <DebugType></DebugType> + <Optimize>True</Optimize> + </PropertyGroup> + <ItemGroup> + <Compile Include="$(MSBuildProjectName).cs" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup> +</Project>
\ No newline at end of file |