dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.38k stars 4.75k forks source link

Fuzzlyn: Assertion failed '!m_compiler->lvaInSsa(tree->GetLclNum())' during 'Assertion prop' #109971

Open amanasifkhalid opened 12 hours ago

amanasifkhalid commented 12 hours ago

Hitting on multiple platforms. Example on win-x64:

// Generated by Fuzzlyn v2.4 on 2024-11-17 15:25:04
// Run on X64 Windows
// Seed: 8082722256341804456-vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86avx512fx64,x86bmi1,x86bmi1x64,x86bmi2,x86bmi2x64,x86fma,x86lzcnt,x86lzcntx64,x86pclmulqdq,x86popcnt,x86popcntx64,x86sse,x86ssex64,x86sse2,x86sse2x64,x86sse3,x86sse41,x86sse41x64,x86sse42,x86sse42x64,x86ssse3,x86x86base
// Reduced from 137.3 KiB to 1.0 KiB in 00:02:31
// Hits JIT assert in Release:
// Assertion failed '!m_compiler->lvaInSsa(tree->GetLclNum())' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Assertion prop' (IL size 73; hash 0xade6b36b; FullOpts)
// 
//     File: D:\a\_work\1\s\src\coreclr\jit\optimizer.cpp Line: 3511
// 
using System;
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public class C0
{
    public sbyte F1;
}

public class C1
{
    public C0 F5;
}

public class Program
{
    public static IRuntime s_rt;
    public static C1 s_1;
    public static C0 s_2;
    public static void Main()
    {
        double vr4 = default(double);
        byte vr5 = 0;
        ushort vr6 = 0;
        if (0 >= vr5)
        {
            s_rt.WriteLine(System.BitConverter.DoubleToUInt64Bits(vr4));
        }
        else
        {
            var vr7 = s_1.F5.F1 % vr6;
            try
            {
                M1();
            }
            finally
            {
                s_2 = s_2;
            }
        }
    }

    public static float M1()
    {
        return default(float);
    }
}

public interface IRuntime
{
    void WriteLine<T>(T value);
}

public class Runtime : IRuntime
{
    public void WriteLine<T>(T value) => System.Console.WriteLine(value);
}

cc @dotnet/jit-contrib

dotnet-policy-service[bot] commented 12 hours ago

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch See info in area-owners.md if you want to be subscribed.

jakobbotsch commented 11 hours ago

Andy pointed me at this one as well but haven't had time to dig in yet... It's likely introduced by my recent SSA changes. I'll take a look.