-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Don't eliminate store for the following sequence of instructions ``` ldr wzr, [addrReg, #immOff] str wzr, [addrReg, #immOff] ``` * Add regression test for #56930
- Loading branch information
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/tests/JIT/Regression/JitBlue/Runtime_56930/Runtime_56930.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
|
||
namespace Runtime_56930 | ||
{ | ||
class C0 | ||
{ | ||
public int F1; | ||
public C0(int f1) | ||
{ | ||
F1 = f1; | ||
} | ||
} | ||
|
||
class Program | ||
{ | ||
static C0 s_2 = new C0(1); | ||
|
||
public static int Main() | ||
{ | ||
// Since the following statement is a dead store the next two statements will become | ||
// a NULLCHECK(s_2) followed by STOREIND(&s_2[8], 0) | ||
int val = s_2.F1; | ||
s_2.F1 = 0; | ||
|
||
// On Arm64 these will be compiled to | ||
// | ||
// ldr wzr, [x0, #8] | ||
// str wzr, [x0, #8] | ||
// | ||
// The issue was that the JIT falsely assumes the store to be redundant and eliminated | ||
// the instruction during pipehole optimizations. | ||
|
||
return s_2.F1 + 100; | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/tests/JIT/Regression/JitBlue/Runtime_56930/Runtime_56930.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DebugType>None</DebugType> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |