-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone
Description
GT_JMP has implicit uses of all arguments that local morph needs to count. For example, the following program should print 5678 but prints 1234 instead because of it (repros in .NET 6 and 7):
using InlineIL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
class Program
{
static void Main(string[] args)
{
Foo(new S16 { A = 5678 });
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void Foo(S16 s)
{
Modify(s);
IL.Emit.Jmp(new MethodRef(typeof(Program), nameof(Bar)));
throw IL.Unreachable();
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void Modify(S16 s)
{
s.A = 1234;
Consume(s);
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void Consume(S16 s)
{
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void Bar(S16 s)
{
Console.WriteLine(s.A);
}
private struct S16
{
public int A, B, C, D;
}
}We omit creating a copy for an implicit byref because we think that's the only use in the method.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI