Skip to content

Commit

Permalink
Fix implicit nullchecks for floats on arm64 (#66413)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo authored Mar 10, 2022
1 parent a4a6d30 commit 9030b78
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9755,7 +9755,7 @@ bool Compiler::lvaIsOSRLocal(unsigned varNum)
//
var_types Compiler::gtTypeForNullCheck(GenTree* tree)
{
if (varTypeIsIntegral(tree))
if (varTypeIsArithmetic(tree))
{
#if defined(TARGET_XARCH)
// Just an optimization for XARCH - smaller mov
Expand Down
29 changes: 29 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_65942/Runtime_65942.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;

unsafe class Runtime_65942
{
[MethodImpl(MethodImplOptions.NoInlining)]
private static void Test1(double* a, int i)
{
double unused1 = a[i];
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static void Test2(float* a, int i)
{
float unused1 = a[i];
}

private static int Main()
{
double d = 0;
Test1(&d, 0);

float f = 0;
Test2(&f, 0);
return 100;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>

0 comments on commit 9030b78

Please sign in to comment.