-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sergey Andreenko
committed
Nov 5, 2020
1 parent
fd78d43
commit 546cc65
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/tests/JIT/Regression/JitBlue/Runtime_44266/Runtime_44266.il
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,55 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
// This test shows an inlining of `byref LCL_VAR_ADDR - byref CNST_INT` method that returns a native int. | ||
// However, Jit could try to optimize `-` as `+ -CNST_INT` that could lead to an incorrect `long + (-byref)`. | ||
|
||
.assembly extern System.Console {} | ||
.assembly extern legacy library mscorlib {} | ||
.assembly byrefsubbyref1 { } | ||
.class a extends [mscorlib]System.Object | ||
{ | ||
.field static class ctest S_1 | ||
.method public static native int byrefsubbyref(class ctest& V_1, class ctest& V_2) aggressiveinlining | ||
{ | ||
ldarg 0 | ||
ldarg 1 | ||
sub | ||
ret | ||
} | ||
|
||
.method public static int32 main() cil managed | ||
{ | ||
.entrypoint | ||
.maxstack 2 | ||
.locals init (class ctest V_1, | ||
class ctest V_2, | ||
native int V_3) | ||
newobj instance void ctest::.ctor() | ||
stloc.0 | ||
newobj instance void ctest::.ctor() | ||
dup | ||
stsfld class ctest a::S_1 | ||
stloc.1 | ||
|
||
ldloca V_1 | ||
ldsflda class ctest a::S_1 | ||
call native int a::byrefsubbyref(class ctest&, class ctest&) | ||
stloc V_3 | ||
ldloc V_3 | ||
ret | ||
} | ||
} | ||
|
||
.class private auto ansi ctest | ||
extends [mscorlib]System.Object | ||
{ | ||
.method public specialname rtspecialname | ||
instance void .ctor() cil managed | ||
{ | ||
.maxstack 1 | ||
ldarg.0 | ||
call instance void [mscorlib]System.Object::.ctor() | ||
ret | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/tests/JIT/Regression/JitBlue/Runtime_44266/Runtime_44266.ilproj
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,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.IL"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DebugType /> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).il" /> | ||
</ItemGroup> | ||
</Project> |