Transform SIMD8 to FIELD_LIST if promoted
authorCarol Eidt <carol.eidt@microsoft.com>
Tue, 18 Dec 2018 23:13:07 +0000 (15:13 -0800)
committerCarol Eidt <carol.eidt@microsoft.com>
Tue, 18 Dec 2018 23:13:07 +0000 (15:13 -0800)
Fix dotnet/coreclr#21546

Commit migrated from https://github.com/dotnet/coreclr/commit/ba3b4025a6974e5266181760003cf7552f8ae199

src/coreclr/src/jit/morph.cpp
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_21546/GitHub_21546.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_21546/GitHub_21546.csproj [new file with mode: 0644]

index 0a6a6fc..ebe4105 100644 (file)
@@ -4174,7 +4174,7 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
 #if defined(_TARGET_X86_)
         if (isStructArg)
         {
-            GenTree* lclNode = fgIsIndirOfAddrOfLocal(argx);
+            GenTree* lclNode = argx->OperIs(GT_LCL_VAR) ? argx : fgIsIndirOfAddrOfLocal(argx);
             if ((lclNode != nullptr) &&
                 (lvaGetPromotionType(lclNode->AsLclVarCommon()->gtLclNum) == Compiler::PROMOTION_TYPE_INDEPENDENT))
             {
diff --git a/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_21546/GitHub_21546.cs b/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_21546/GitHub_21546.cs
new file mode 100644 (file)
index 0000000..1d94212
--- /dev/null
@@ -0,0 +1,78 @@
+// 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.Collections.Generic;
+using System.Linq;
+using System.Runtime.CompilerServices;
+
+using Point = System.Numerics.Vector2;
+
+namespace GitHub_21546
+{
+    public class test
+    {
+        static Point checkA;
+        static Point checkB;
+        static Point checkC;
+        static int   returnVal;
+
+        [MethodImpl(MethodImplOptions.NoInlining)]
+        static void check(Point a, Point b, Point c)
+        {
+            if (a != checkA)
+            {
+                Console.WriteLine($"A doesn't match. Should be {checkA} but is {a}");
+                returnVal = -1;
+            }
+            if (b != checkB)
+            {
+                Console.WriteLine($"B doesn't match. Should be {checkB} but is {b}");
+                returnVal = -1;
+            }
+            if (c != checkC)
+            {
+                Console.WriteLine($"C doesn't match. Should be {checkC} but is {c}");
+                returnVal = -1;
+            }
+        }
+
+        [MethodImpl(MethodImplOptions.NoInlining)]
+        static void FailureCase(List<Point> p)
+        {
+            Point p1 = p[0];
+            Point p2 = p.Last();
+
+            check(p1, p[1], p2);
+            check(p1, p[1], p2);
+            check(p1, p[1], p2);
+        }
+
+        static Point NextPoint(Random random)
+        {
+            return new Point(
+                (float)random.NextDouble(),
+                (float)random.NextDouble()
+            );
+        }
+
+        static int Main()
+        {
+            returnVal     = 100;
+            Random random = new Random(13);
+            List<Point> p = new List<Point>();
+
+            checkA = NextPoint(random);
+            p.Add(checkA);
+            checkB = NextPoint(random);
+            p.Add(checkB);
+            checkC = NextPoint(random);
+            p.Add(checkC);
+
+            FailureCase(p);
+
+            return returnVal;
+        }
+    }
+}
diff --git a/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_21546/GitHub_21546.csproj b/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_21546/GitHub_21546.csproj
new file mode 100644 (file)
index 0000000..42f8a01
--- /dev/null
@@ -0,0 +1,33 @@
+<?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>
+  </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>
+  <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>
\ No newline at end of file