Add repro for `(reg2 == REG_NEXT(reg1)) || (reg2 == REG_LR)` assert in `codegenarm64...
authorSergey Andreenko <seandree@microsoft.com>
Wed, 5 Dec 2018 03:58:32 +0000 (19:58 -0800)
committerGitHub <noreply@github.com>
Wed, 5 Dec 2018 03:58:32 +0000 (19:58 -0800)
* Add a repro.

* Exclude the failing test.

* fix formatting

tests/issues.targets
tests/src/JIT/Regression/JitBlue/DevDiv_736188/DevDiv_736188.cs [new file with mode: 0644]
tests/src/JIT/Regression/JitBlue/DevDiv_736188/DevDiv_736188.csproj [new file with mode: 0644]

index 308f10e..9abb7f4 100644 (file)
         <ExcludeList Include="$(XunitTestBinBase)/readytorun/r2rdump/R2RDumpTest/*">
             <Issue>19441</Issue>
         </ExcludeList>
+        <ExcludeList Include="$(XunitTestBinBase)/JIT/Regression/JitBlue/DevDiv_736188/DevDiv_736188/*">
+            <Issue>21363</Issue>
+        </ExcludeList>
     </ItemGroup>
 
     <ItemGroup Condition="'$(XunitTestBinBase)' != ''">
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_736188/DevDiv_736188.cs b/tests/src/JIT/Regression/JitBlue/DevDiv_736188/DevDiv_736188.cs
new file mode 100644 (file)
index 0000000..a76c0b4
--- /dev/null
@@ -0,0 +1,34 @@
+// 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.
+
+// The test exposed an issue in the prolog generation for arm64. The jit did not expect any holes in the mask
+// of registers that needed to be zero initialized in the prolog. 
+// The proj file sets 2 stress modes for JitStressRegs: 0x4 and 0x200.
+// 0x4 forces Jit to choose registers starting from the end of the register window (like R27, R28);
+// 0x200 forces different register windows for different blocks and creates resolution move that uses a temp int register (R19).
+// It ends up with the mask {R19 | R27 | R28} that hits assert in `genSaveCalleeSavedRegistersHelp` that R19 and R27 must be paired.
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace DevDiv_736188
+{
+    class Program
+    {
+        private static object InternalSyncObject = new object();
+
+        [MethodImpl(MethodImplOptions.NoInlining)]
+        internal static T CallWith3Args<T>(ref T field, ref object syncObject, Func<T> initializer) => default;
+
+        [MethodImpl(MethodImplOptions.NoInlining)]
+        internal static T CallWith2Args<T>(ref T field, Func<T> initializer) where T : class =>
+    CallWith3Args(ref field, ref InternalSyncObject, initializer);
+
+        static int Main(string[] args)
+        {
+            CallWith2Args(ref args, null);
+            return 100;
+        }
+    }
+}
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_736188/DevDiv_736188.csproj b/tests/src/JIT/Regression/JitBlue/DevDiv_736188/DevDiv_736188.csproj
new file mode 100644 (file)
index 0000000..9bfa92a
--- /dev/null
@@ -0,0 +1,45 @@
+<?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>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{2649FAFE-07BF-4F93-8120-BA9A69285ABB}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+       <LangVersion>latest</LangVersion>
+       
+  </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>None</DebugType>
+    <Optimize>True</Optimize>
+  </PropertyGroup>
+  <PropertyGroup>
+    <CLRTestBatchPreCommands><![CDATA[
+$(CLRTestBatchPreCommands)
+set COMPlus_JitStressRegs=0x204
+]]></CLRTestBatchPreCommands>
+    <BashCLRTestPreCommands><![CDATA[
+$(BashCLRTestPreCommands)
+export COMPlus_JitStressRegs=0x204
+]]></BashCLRTestPreCommands>
+  </PropertyGroup>
+  <ItemGroup>
+    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+      <Visible>False</Visible>
+    </CodeAnalysisDependentAssemblyPaths>
+  </ItemGroup>
+  <ItemGroup>
+    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="$(MSBuildProjectName).cs" />
+  </ItemGroup>
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>