Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
SingleAccretion committed Jun 9, 2022
1 parent 3cfd7a0 commit 10166f5
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_70466/Runtime_70466.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// 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;

public class Runtime_70466
{
public static int Main()
{
Problem(1, 0);
return 100;
}

// This method is carefully crafted such that we end up with an unused ARR_ADDR node by rationalization
// time, of which the child operand will need to be explicitly marked "unused value" for LIR purposes.
//
[MethodImpl(MethodImplOptions.NoInlining)]
private static void Problem(byte b, int idx)
{
var a = new byte[] { b };
var a1 = new byte[] { b, b };
var a2 = new byte[] { b, b, b };

if (idx == 0)
{
if (a[idx] == 1)
{
Use(1);
}
JitUse(a1[idx] + a2[idx]);
}
}

public static void Use<T>(T arg) { }

[MethodImpl(MethodImplOptions.NoInlining)]
public static void JitUse<T>(T arg) { }
}
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>

0 comments on commit 10166f5

Please sign in to comment.