diff options
author | mikedn <onemihaid@hotmail.com> | 2018-12-21 02:10:27 +0200 |
---|---|---|
committer | Sergey Andreenko <seandree@microsoft.com> | 2018-12-20 16:10:27 -0800 |
commit | 3e216841102ab82a6f4b276aadd8558d78819c12 (patch) | |
tree | 5c9d51facb5b6bbb81e1abc50d2b5c732d2ead21 /tests | |
parent | b0996f3c12faf1d1b5d965087cfa62fc8c84a75b (diff) | |
download | coreclr-3e216841102ab82a6f4b276aadd8558d78819c12.tar.gz coreclr-3e216841102ab82a6f4b276aadd8558d78819c12.tar.bz2 coreclr-3e216841102ab82a6f4b276aadd8558d78819c12.zip |
Don't morph volatile IND(ADDR(LCL_VAR)) (#20843)
Besides the fact that volatile indirections aren't supposed to be removed doing so in this case results in incorrect code being generated.
The GT_IND node has GTF_DONT_CSE set and this gets copied to the GT_LCL_VAR node. Later this prevents the insertion of a normalization cast because GTF_DONT_CSE on a GT_LCL_VAR node is assumed to mean that the variable address is being taken.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/JIT/Regression/JitBlue/GitHub_19599/GitHub_19599.cs | 30 | ||||
-rw-r--r-- | tests/src/JIT/Regression/JitBlue/GitHub_19599/GitHub_19599.csproj | 17 |
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_19599/GitHub_19599.cs b/tests/src/JIT/Regression/JitBlue/GitHub_19599/GitHub_19599.cs new file mode 100644 index 0000000000..2705d45543 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_19599/GitHub_19599.cs @@ -0,0 +1,30 @@ +// 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.Runtime.CompilerServices; +using System.Threading; + +struct S0 +{ + public byte F0; +} + +class Program +{ + static S0 s_2; + static long s_5; + + static int Main() + { + s_2.F0 = 128; + M7(s_2); + return (s_5 == 128) ? 100 : -1; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static void M7(S0 arg0) + { + s_5 = Volatile.Read(ref arg0.F0); + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_19599/GitHub_19599.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_19599/GitHub_19599.csproj new file mode 100644 index 0000000000..c24f74b865 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_19599/GitHub_19599.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> |