Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
echesakov authored Oct 14, 2019
1 parent 97fbdc7 commit 45a1369
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@
<ExcludeList Include="$(XunitTestBinBase)/JIT/Methodical/tailcall_v4/hijacking/*">
<Issue>arm64 does not support tailcall helper</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/JIT/Regression/JitBlue/GitHub_26491/**/*">
<Issue>26491</Issue>
</ExcludeList>
</ItemGroup>

<!-- Windows x64 specific excludes -->
Expand Down
129 changes: 129 additions & 0 deletions tests/src/JIT/Regression/JitBlue/GitHub_26491/GitHub_26491.il
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.


// The test exposes an assertion in gtNewTempAssign on Arm64 when a method
// 1. returns a struct with one field of TYP_SIMD16 (e.g. Vector128<byte>) and
// 2. requires to have a single return basic block;
// this condition becomes true when the method is
// 2.1. synchronized or
// 2.2. needs profiling ELT hooks or
// 2.3. has more than 4 return-points.
//
// The issue is due to:
// 1. importer transforming the return values of each GT_RETURN node
// LCL_VAR struct V00 loc0
// into
// LCL_FLD simd16 V00 loc0 [+0]
// 2. morph merging the return values of "original" return basic blocks into
// a temp that holds the return value in the new "designated" return basic block.
// During the merge gtNewTempAssign does not expect the source value of TYP_SIMD16
// and the destination value of TYP_STRUCT.

.assembly extern System.Runtime
{
}

.assembly extern System.Runtime.Intrinsics
{
}

.assembly GitHub_26491
{
}

.class private auto ansi beforefieldinit GitHub_26491 extends [System.Runtime]System.Object
{
.class sequential ansi sealed nested private beforefieldinit ReturnType
extends [System.Runtime]System.ValueType
{
.field private valuetype [System.Runtime.Intrinsics]System.Runtime.Intrinsics.Vector128`1<uint8> _simd16
}

.method private hidebysig static valuetype GitHub_26491/ReturnType MultipleReturns(int32 i) cil managed noinlining
{
// Code size 74 (0x4a)
.maxstack 1
.locals init (valuetype GitHub_26491/ReturnType V_0)
IL_0000: ldarg.0
IL_0001: switch (IL_0018, IL_0022, IL_002c, IL_0036)
IL_0016: br.s IL_0040

IL_0018: ldloca.s V_0
IL_001a: initobj GitHub_26491/ReturnType
IL_0020: ldloc.0
IL_0021: ret

IL_0022: ldloca.s V_0
IL_0024: initobj GitHub_26491/ReturnType
IL_002a: ldloc.0
IL_002b: ret

IL_002c: ldloca.s V_0
IL_002e: initobj GitHub_26491/ReturnType
IL_0034: ldloc.0
IL_0035: ret

IL_0036: ldloca.s V_0
IL_0038: initobj GitHub_26491/ReturnType
IL_003e: ldloc.0
IL_003f: ret

IL_0040: ldloca.s V_0
IL_0042: initobj GitHub_26491/ReturnType
IL_0048: ldloc.0
IL_0049: ret
}

.method private hidebysig static valuetype GitHub_26491/ReturnType SingleReturnSynchronized() cil managed synchronized noinlining
{
.maxstack 1
.locals init (valuetype GitHub_26491/ReturnType V_0)
IL_0000: ldloca.s V_0
IL_0002: initobj GitHub_26491/ReturnType
IL_0008: ldloc.0
IL_0009: ret
}

.method private hidebysig static valuetype GitHub_26491/ReturnType SingleReturn() cil managed noinlining
{
.maxstack 1
.locals init (valuetype GitHub_26491/ReturnType V_0)
IL_0000: ldloca.s V_0
IL_0002: initobj GitHub_26491/ReturnType
IL_0008: ldloc.0
IL_0009: ret
}

.method public hidebysig static int32 Main(string[] args) cil managed
{
.entrypoint
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldstr "MultipleReturns"
IL_0006: call int32 [System.Runtime]System.Array::IndexOf<string>(!!0[], !!0)
IL_000b: ldc.i4.m1
IL_000c: beq.s IL_001b

IL_000e: ldc.i4 0x677b
IL_0013: call valuetype GitHub_26491/ReturnType GitHub_26491::MultipleReturns(int32)
IL_0018: pop
IL_0019: br.s IL_0037

IL_001b: ldarg.0
IL_001c: ldstr "SingleReturnSynchronized"
IL_0021: call int32 [System.Runtime]System.Array::IndexOf<string>(!!0[], !!0)
IL_0026: ldc.i4.m1
IL_0027: beq.s IL_0031

IL_0029: call valuetype GitHub_26491/ReturnType GitHub_26491::SingleReturnSynchronized()
IL_002e: pop
IL_002f: br.s IL_0037

IL_0031: call valuetype GitHub_26491/ReturnType GitHub_26491::SingleReturn()
IL_0036: pop
IL_0037: ldc.i4.s 100
IL_0039: ret
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestExecutionArguments>MultipleReturns</CLRTestExecutionArguments>
</PropertyGroup>
<ItemGroup>
<Compile Include="GitHub_26491.il" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<CLRTestKind>RunOnly</CLRTestKind>
<CLRTestProjectToRun>GitHub_26491_MultipleReturns.ilproj</CLRTestProjectToRun>
<CLRTestExecutionArguments>SingleReturnSynchronized</CLRTestExecutionArguments>
</PropertyGroup>
</Project>

0 comments on commit 45a1369

Please sign in to comment.