Skip to content

Commit 73bffaf

Browse files
Ensure side effects are preserved for Arm64 (#105963)
1 parent 684998f commit 73bffaf

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

src/coreclr/jit/gentree.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31735,6 +31735,7 @@ GenTree* Compiler::gtFoldExprHWIntrinsic(GenTreeHWIntrinsic* tree)
3173531735
// op3 has side effects, this would require us to append a new statement
3173631736
// to ensure that it isn't lost, which isn't safe to do from the general
3173731737
// purpose handler here. We'll recognize this and mark it in VN instead
31738+
break;
3173831739
}
3173931740

3174031741
// op3 has no side effects, so we can return op2 directly
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System;
5+
using System.Runtime.CompilerServices;
6+
using System.Numerics;
7+
using System.Runtime.Intrinsics;
8+
using System.Runtime.Intrinsics.Arm;
9+
using Xunit;
10+
11+
// Generated by Fuzzlyn v2.2 on 2024-08-01 14:42:46
12+
// Run on Arm64 MacOS
13+
// Seed: 17520120436908093806-vectort,vector64,vector128,armadvsimd,armadvsimdarm64,armaes,armarmbase,armarmbasearm64,armcrc32,armcrc32arm64,armdp,armrdm,armrdmarm64,armsha1,armsha256
14+
// Reduced from 35.4 KiB to 0.6 KiB in 00:00:19
15+
// Debug: Throws 'System.NullReferenceException'
16+
// Release: Runs successfully
17+
18+
public class Runtime_105818
19+
{
20+
private static Vector64<long> s_1;
21+
22+
[Fact]
23+
public static void TestEntryPoint()
24+
{
25+
if (AdvSimd.IsSupported)
26+
{
27+
Assert.Throws<NullReferenceException>(() => M1());
28+
}
29+
}
30+
31+
private static void M1()
32+
{
33+
var vr2 = Vector64.Create<uint>(4294967295U);
34+
var vr3 = Vector64.Create<uint>(0);
35+
AdvSimd.BitwiseSelect(vr2, vr3, Vector64.CreateScalar(M2()));
36+
System.Console.WriteLine(s_1);
37+
}
38+
39+
private static uint M2()
40+
{
41+
sbyte[] var0 = default(sbyte[]);
42+
return (uint)var0[0];
43+
}
44+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<Optimize>True</Optimize>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<Compile Include="$(MSBuildProjectName).cs" />
7+
</ItemGroup>
8+
</Project>

0 commit comments

Comments
 (0)