summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrian Sullivan <briansul@microsoft.com>2019-01-10 18:50:35 -0800
committerGitHub <noreply@github.com>2019-01-10 18:50:35 -0800
commitdf88b1f6f858a558306e0e012c16d9de9c62ec15 (patch)
tree2cb161b64731b031f0aa5354e9cddf6f36075d66 /tests
parent689035630bd8191da725cd3a9caf28c71142071f (diff)
parentb4cbfba170ccdf277a5080bf24460fde4c41bbf3 (diff)
downloadcoreclr-df88b1f6f858a558306e0e012c16d9de9c62ec15.tar.gz
coreclr-df88b1f6f858a558306e0e012c16d9de9c62ec15.tar.bz2
coreclr-df88b1f6f858a558306e0e012c16d9de9c62ec15.zip
Merge pull request #21804 from briansull/fix-unbox-opt
Fix issue with devirtualization and tailcalls
Diffstat (limited to 'tests')
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_754566/DevDiv_754566.il106
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_754566/DevDiv_754566.ilprog35
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_754566/test.cs31
3 files changed, 172 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_754566/DevDiv_754566.il b/tests/src/JIT/Regression/JitBlue/DevDiv_754566/DevDiv_754566.il
new file mode 100644
index 0000000000..21290d24da
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_754566/DevDiv_754566.il
@@ -0,0 +1,106 @@
+// 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.
+
+
+// Metadata version: v4.0.30319
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+ .ver 4:0:0:0
+}
+.assembly test
+{
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module test.exe
+// MVID: {A80A87C4-1DDB-4F93-AB31-444266FDFA55}
+.imagebase 0x00400000
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003 // WINDOWS_CUI
+.corflags 0x00000001 // ILONLY
+// Image base: 0x0000024A58020000
+
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class private auto ansi beforefieldinit Program
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig instance string
+ Test(int32 val) cil managed noinlining
+ {
+ // This testcase ensures that we don't perform devirtualization
+ // via an unboxing optimization, for the callvirt below.
+
+ // Code size 12 (0xc)
+ .maxstack 8
+ IL_0000: ldarg.1
+ IL_0001: box [mscorlib]System.Int32
+ tail.
+ IL_0006: callvirt instance string [mscorlib]System.Object::ToString()
+ IL_000b: ret
+ } // end of method Program::Test
+
+ .method private hidebysig static int32
+ Main(string[] args) cil managed
+ {
+ .entrypoint
+ // Code size 73 (0x49)
+ .maxstack 2
+ .locals init (int32 V_0,
+ class Program V_1,
+ string V_2)
+ IL_0000: ldc.i4.m1
+ IL_0001: stloc.0
+ IL_0002: newobj instance void Program::.ctor()
+ IL_0007: stloc.1
+ IL_0008: ldloc.1
+ IL_0009: ldc.i4.s 42
+ IL_000b: callvirt instance string Program::Test(int32)
+ IL_0010: stloc.2
+ IL_0011: ldloc.2
+ IL_0012: ldstr "42"
+ IL_0017: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_001c: brfalse.s IL_002d
+
+ IL_001e: ldstr "=== PASSED ==="
+ IL_0023: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0028: ldc.i4.s 100
+ IL_002a: stloc.0
+ IL_002b: br.s IL_0047
+
+ IL_002d: ldstr "result shoudl be 42, is= "
+ IL_0032: ldloc.2
+ IL_0033: call string [mscorlib]System.String::Concat(string,
+ string)
+ IL_0038: call void [mscorlib]System.Console::WriteLine(string)
+ IL_003d: ldstr "+++ FAILED +++"
+ IL_0042: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0047: ldloc.0
+ IL_0048: ret
+ } // end of method Program::Main
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Program::.ctor
+
+} // end of class Program
+
+
+// =============================================================
+
+// *********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file test2.res
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_754566/DevDiv_754566.ilprog b/tests/src/JIT/Regression/JitBlue/DevDiv_754566/DevDiv_754566.ilprog
new file mode 100644
index 0000000000..d30b4aeb0c
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_754566/DevDiv_754566.ilprog
@@ -0,0 +1,35 @@
+<?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)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
+ <PropertyGroup>
+ <DebugType>PdbOnly</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="DevDiv_754566.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_754566/test.cs b/tests/src/JIT/Regression/JitBlue/DevDiv_754566/test.cs
new file mode 100644
index 0000000000..a07bb7bd3c
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_754566/test.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Runtime.CompilerServices;
+
+class Program
+{
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public String Test(int val)
+ {
+ return ((Object) val).ToString();
+ }
+
+ static int Main(string[] args)
+ {
+ int exitStatus = -1;
+
+ Program p = new Program();
+
+ String result = p.Test(42);
+ if (result == "42")
+ {
+ Console.WriteLine("=== PASSED ===");
+ exitStatus = 100;
+ }
+ else
+ {
+ Console.WriteLine("result shoudl be 42, is= " + result);
+ Console.WriteLine("+++ FAILED +++");
+ }
+ return exitStatus;
+ }
+}