Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: Assertion failed 'next != def && "found def after use"' during 'Lowering nodeinfo' #77158

Closed
jakobbotsch opened this issue Oct 18, 2022 · 7 comments · Fixed by #77166
Closed
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@jakobbotsch
Copy link
Member

// Generated by Fuzzlyn v1.5 on 2022-10-17 21:02:02
// Run on Arm64 MacOS
// Seed: 16660823782825460095
// Reduced from 109.3 KiB to 0.2 KiB in 00:00:31
// Hits JIT assert in Release:
// Assertion failed 'next != def && "found def after use"' in 'Program:M43():bool' during 'Lowering nodeinfo' (IL size 24; hash 0xbbd81c14; FullOpts)
// 
//     File: /Users/runner/work/1/s/src/coreclr/jit/lir.cpp Line: 1615
// 
public class Program
{
    public static bool s_21;
    public static ulong[] s_41;
    public static void Main()
    {
        M43();
    }

    public static bool M43()
    {
        return !((0 <= s_41[0]) & s_21);
    }
}
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Oct 18, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Oct 18, 2022
@ghost
Copy link

ghost commented Oct 18, 2022

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

Issue Details
// Generated by Fuzzlyn v1.5 on 2022-10-17 21:02:02
// Run on Arm64 MacOS
// Seed: 16660823782825460095
// Reduced from 109.3 KiB to 0.2 KiB in 00:00:31
// Hits JIT assert in Release:
// Assertion failed 'next != def && "found def after use"' in 'Program:M43():bool' during 'Lowering nodeinfo' (IL size 24; hash 0xbbd81c14; FullOpts)
// 
//     File: /Users/runner/work/1/s/src/coreclr/jit/lir.cpp Line: 1615
// 
public class Program
{
    public static bool s_21;
    public static ulong[] s_41;
    public static void Main()
    {
        M43();
    }

    public static bool M43()
    {
        return !((0 <= s_41[0]) & s_21);
    }
}
Author: jakobbotsch
Assignees: -
Labels:

area-CodeGen-coreclr, untriaged

Milestone: -

@jakobbotsch
Copy link
Member Author

jakobbotsch commented Oct 18, 2022

Introduced by #74806, cc @En3Tho @EgorBo

@jakobbotsch jakobbotsch removed the untriaged New issue has not been triaged by the area owner label Oct 18, 2022
@jakobbotsch jakobbotsch added this to the 8.0.0 milestone Oct 18, 2022
@jakobbotsch
Copy link
Member Author

FWIW, it's likely the optimization there should be placing the notNode after andOp1, not before andOp2, which makes assumptions on linear order.

@En3Tho
Copy link
Contributor

En3Tho commented Oct 18, 2022

Thank you for the pointer.

@En3Tho
Copy link
Contributor

En3Tho commented Oct 18, 2022

Hmm. Now that I remember there was a check (well, there is)

#ifdef TARGET_ARM64
    // Do not optimise further if op1 has a contained chain.
    if (op1->OperIs(GT_AND) &&
        (op1->isContainedCompareChainSegment(op1->gtGetOp1()) || op1->isContainedCompareChainSegment(op1->gtGetOp2())))
    {
        return cmp;
    }
#endif

And my optimization did not have any effect on arm64 (at least there were no spmi diffs).
I'm having some trouble reproing this :(

@jakobbotsch
Copy link
Member Author

I'm having some trouble reproing this :(

It repros for me with altjit from win-x64. From powershell:

$env:DOTNET_AltJit="M43"
$env:DOTNET_AltJitName="clrjit_universal_arm64_x64.dll"
$env:DOTNET_AltJitOS="macOS"
$env:DOTNET_TieredCompilation=0
<path to core_root> example.dll

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Oct 18, 2022
@En3Tho
Copy link
Contributor

En3Tho commented Oct 18, 2022

You are right. Inserting notNode after andOp1 and not before andOp2 no longer produces this assert. My examples on x64 do not produce an assert either. I filed a pr. Can you please run fuzzlyn there if needed?
Thank you for help!

@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Oct 18, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants