-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JIT: Fix generating unrepresentable nullchecks on ARM64 (#71687)
The logic in lowering could in some struct and primitive type cases generate an unrepresentable NULLCHECK node for ARM64/LA64 when there was a contained address mode. We now transform unused indirections and create address modes in the opposite order on non-xarch to avoid these unrepresentable nullchecks. Fix #71684
- Loading branch information
1 parent
a965218
commit 9534947
Showing
4 changed files
with
77 additions
and
3 deletions.
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
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
47 changes: 47 additions & 0 deletions
47
src/tests/JIT/Regression/JitBlue/Runtime_71687/Runtime_71687.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,47 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Numerics; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.Intrinsics; | ||
|
||
class Runtime_71687 | ||
{ | ||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static void Test<T>(ref T first, int i) | ||
{ | ||
Consume(Unsafe.Add(ref first, i)); | ||
} | ||
|
||
// Must be inlined so we end up with null check above | ||
private static void Consume<T>(T value) { } | ||
|
||
private static int Main() | ||
{ | ||
Test(ref (new byte[10])[0], 5); | ||
Test(ref (new sbyte[10])[0], 5); | ||
Test(ref (new ushort[10])[0], 5); | ||
Test(ref (new short[10])[0], 5); | ||
Test(ref (new uint[10])[0], 5); | ||
Test(ref (new int[10])[0], 5); | ||
Test(ref (new ulong[10])[0], 5); | ||
Test(ref (new long[10])[0], 5); | ||
Test(ref (new float[10])[0], 5); | ||
Test(ref (new double[10])[0], 5); | ||
Test(ref (new object[10])[0], 5); | ||
Test(ref (new string[10])[0], 5); | ||
Test(ref (new Vector<float>[10])[0], 5); | ||
Test(ref (new Vector128<float>[10])[0], 5); | ||
Test(ref (new Vector256<float>[10])[0], 5); | ||
Test(ref (new Struct1[10])[0], 5); | ||
Test(ref (new Struct2[10])[0], 5); | ||
Test(ref (new Struct4[10])[0], 5); | ||
Test(ref (new Struct8[10])[0], 5); | ||
return 100; | ||
} | ||
|
||
private struct Struct1 { public byte Field; } | ||
private struct Struct2 { public short Field; } | ||
private struct Struct4 { public int Field; } | ||
private struct Struct8 { public long Field; } | ||
} |
9 changes: 9 additions & 0 deletions
9
src/tests/JIT/Regression/JitBlue/Runtime_71687/Runtime_71687.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,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |