Skip to content

JIT: Assertion failed 'isContainable || supportsRegOptional' #118466

@AndyAyersMS

Description

@AndyAyersMS

From fuzzlyn (from #118368, but happens in main without that PR).

// Generated by Fuzzlyn v3.3 on 2025-08-05 17:40:02
// Run on X86 Windows
// Seed: 9882026655407373813-vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86bmi1,x86bmi2,x86fma,x86lzcnt,x86pclmulqdq,x86popcnt,x86sse,x86sse2,x86sse3,x86sse41,x86sse42,x86ssse3,x86x86base
// Reduced from 124.1 KiB to 1.5 KiB in 00:04:19
// Hits JIT assert for Release:
// Assertion failed 'isContainable || supportsRegOptional' in 'Program:M16(byte)' during 'Generate code' (IL size 72; hash 0x646d3daa; FullOpts)
// 
//     File: D:\a\_work\1\s\src\coreclr\jit\hwintrinsiccodegenxarch.cpp Line: 61
// 
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public class Program
{
    public static IRuntime s_rt;
    public static byte s_12;
    public static bool s_18;
    public static Vector128<long> s_30;
    public static void Main()
    {
        CollectibleALC alc = new CollectibleALC();
        System.Reflection.Assembly asm = alc.LoadFromAssemblyPath(System.Reflection.Assembly.GetExecutingAssembly().Location);
        System.Reflection.MethodInfo mi = asm.GetType(typeof(Program).FullName).GetMethod(nameof(MainInner));
        System.Type runtimeTy = asm.GetType(typeof(Runtime).FullName);
        mi.Invoke(null, new object[] { System.Activator.CreateInstance(runtimeTy) });
    }

    public static void MainInner(IRuntime rt)
    {
        s_rt = rt;
        M16(s_12);
    }

    public static void M16(byte arg0)
    {
        try
        {
            s_rt.WriteLine("c_66", 4294967195U);
        }
        catch (System.Exception)when (s_18)
        {
        }

        arg0 %= arg0;
        var vr2 = arg0 & 4294967295U;
        var vr1 = Vector128.Create<long>(vr2);
        s_30 = Sse2.ShiftLeftLogical128BitLane(vr1, 0);
    }
}

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

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

public class CollectibleALC : System.Runtime.Loader.AssemblyLoadContext
{
    public CollectibleALC() : base(true)
    {
    }
}

Run with TC=0:

// Assertion failed 'isContainable || supportsRegOptional' in 'Program:M16(byte)' during 'Generate code' (IL size 72; hash 0x646d3daa; FullOpts)
// 
//     File: D:\a\_work\1\s\src\coreclr\jit\hwintrinsiccodegenxarch.cpp Line: 61

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions