#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))
{
--- /dev/null
+// 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;
+ }
+ }
+}
--- /dev/null
+<?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