Runtime: [RFC] Assertion failed 'OperIs(GT_NOP, GT_CALL, GT_FIELD_LIST, GT_COMMA) || OperIsCompare() || OperIsLong() || OperIsSIMD() || OperIsHWIntrinsic()'

Created on 11 Dec 2019  路  10Comments  路  Source: dotnet/runtime

Hi,

Base on this commit.

Testcase: Hello.dll

Build and run option:

./src/coreclr/build.sh skipcrossgen
cp artifacts/bin/coreclr/Linux.x64.Debug/IL/System.Private.CoreLib.dll artifacts/bin/coreclr/Linux.x64.Debug/
export CORE_LIBRARIES=/home/zhaixiang/runtime/.dotnet/shared/Microsoft.NETCore.App/3.0.0
export COMPlus_JitFunctionTrace=1
export COMPlus_JitDumpIR="*"
gdb --args ./artifacts/bin/coreclr/Linux.x64.Debug/corerun /home/zhaixiang/HelloWorld.dll

Assertion failed:

...
IR after PHASE_EMPTY_TRY (switch: EMPTYTRY)

Method System.AppContext::Setup, hash=fd42e87f

BB01:

                                 NOP                   
                              STMT00000
    t71                        = CNS_INT                HANDLE(0x7fff7bfd45e0)
    t72                        = IND                    t71
    t73                        = CNS_INT                0(0x0)
    t74                        = EQ                     t72, t73
                                 CALL:H                 HELPER.CORINFO_HELP_DBG_IS_JUST_MY_CODE
                                 NOP                   

Assert failure(PID 8411 [0x000020db], Thread: 8411 [0x20db]): Assertion failed 'OperIs(GT_NOP, GT_CALL, GT_COMMA) || OperIsCompare() || OperIsLong() || OperIsSIMD() || OperIsHWIntrinsic()' in 'System.AppContext:Setup(long,long,int)' (IL size 95)

    File: /home/zhaixiang/runtime/src/coreclr/src/jit/gentree.h Line: 964
    Image: /home/zhaixiang/runtime/artifacts/bin/coreclr/Linux.x64.Debug/corerun

And CoreCLR 3.x branch for ARM64 and MIPS64 are also able to reproduce the issue:

ARM64:

...
IR after PHASE_EMPTY_TRY (switch: EMPTYTRY)

Method System.AppContext::Setup, hsh=0xd8570543

BB01:

                                 NOP                   
                                 STMT                   t0

    t81                        = CNS_INT                HANDLE(0x7f3d1b4658)
    t82                        = IND                    t81
    t83                        = CNS_INT                0(0x0)
    t84                        = EQ                     t82, t83
                                 CALL:H                 HELPER.CORINFO_HELP_DBG_IS_JUST_MY_CODE
                                 NOP                   

Assert failure(PID 16360 [0x00003fe8], Thread: 16360 [0x3fe8]): Assertion failed 'OperIs(GT_NOP, GT_CALL, GT_FIELD_LIST, GT_COMMA) || OperIsCompare() || OperIsLong() || OperIsSIMD() || OperIsHWIntrinsic()' in 'System.AppContext:Setup(long,long,int)' (IL size 65)

    File: /home/loongson/zhaixiang/coreclr-mips64-dev/src/jit/gentree.h Line: 975
    Image: /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.arm64.Debug/corerun

MIPS64:

...
IR after PHASE_EMPTY_TRY (switch: EMPTYTRY)

Method System.AppContext::Setup, hsh=0xd8570543

BB01:

                                 NOP                   
                                 STMT                   t0

    t81                        = CNS_INT                HANDLE(0xff7c750658)
    t82                        = IND                    t81
    t83                        = CNS_INT                0(0x0)
    t84                        = EQ                     t82, t83
                                 CALL:H                 HELPER.CORINFO_HELP_DBG_IS_JUST_MY_CODE
                                 NOP                   
                                 COLON                  t85, t86

Assert failure(PID 24271 [0x00005ecf], Thread: 24271 [0x5ecf]): Assertion failed 'OperIs(GT_NOP, GT_CALL, GT_FIELD_LIST, GT_COMMA) || OperIsCompare() || OperIsLong() || OperIsSIMD() || OperIsHWIntrinsic()' in 'System.AppContext:Setup(long,long,int)' (IL size 65)

    File: /home/loongson/zhaixiang/coreclr-mips64-dev/src/jit/gentree.h Line: 975
    Image: /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.mips64.Debug/corerun

Workaround patch:

diff --git a/src/coreclr/src/jit/gentree.h b/src/coreclr/src/jit/gentree.h
index c88ba80..0487981 100644
--- a/src/coreclr/src/jit/gentree.h
+++ b/src/coreclr/src/jit/gentree.h
@@ -960,8 +960,8 @@ public:
         if (gtType == TYP_VOID)
         {
             // These are the only operators which can produce either VOID or non-VOID results.
-            assert(OperIs(GT_NOP, GT_CALL, GT_COMMA) || OperIsCompare() || OperIsLong() || OperIsSIMD() ||
-                   OperIsHWIntrinsic());
+            assert(OperIs(GT_NOP, GT_CALL, GT_COMMA, GT_COLON, GT_QMARK) ||
+                   OperIsCompare() || OperIsLong() || OperIsSIMD() || OperIsHWIntrinsic());
             return false;
         }

Request for comments.

Thanks,
Leslie Zhai

area-CodeGen-coreclr

Most helpful comment

With regard to COMPlus_JitDumpIR it is probably not worth fixing it now and it probably should be deleted

That would be good IMO as it's quite a bit of code. When it first appeared I thought it's great to have this kind of linear dump. And then never used it, not even once. And instead went on improving tree dumps :)

All 10 comments

cc @BruceForstall

I will take a look.

The issue is specific to COMPlus_JitDumpIR, that complus is outdated and I don't think anybody on the team is using it.
The failure can be reproduced on Windows almost at any test, it happens because cNodeIR calls tree->IsValue() during early phases and IsValue is LIR specific.

I suggest you to use COMPLUS_JitDump variable instead and ask us if any parts of its output are not clear or difficult to read. We will happy to answer and improve its output.

With regard to COMPlus_JitDumpIR it is probably not worth fixing it now and it probably should be deleted, cc @CarolEidt @dotnet/jit-contrib .

With regard to COMPlus_JitDumpIR it is probably not worth fixing it now and it probably should be deleted

That would be good IMO as it's quite a bit of code. When it first appeared I thought it's great to have this kind of linear dump. And then never used it, not even once. And instead went on improving tree dumps :)

I agree with @mikedn. If anyone actually uses it, speak up. But I think only the original author ever used it.

Hi @sandreenko

Thanks for your kind response!

The issue is specific to COMPlus_JitDumpIR

Yes, I use it to dump the High IR. I mentioned it in the Build and run option above. @QiaoVanke asked me that there might be some issues when porting src/System.Private.CoreLib and CoreFX 3.1 branch for MIPS64. So I need to diff the IR with other architectures for checking my porting work.

I suggest you to use COMPLUS_JitDump variable instead

JitDump failed to work for the testcase JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128_r/ConvertToVector128_r.exe. Sorry for that! @QiaoVanke and I are fixing it for MIPS64. So I just use JitDumpIR temporarily.

With regard to COMPlus_JitDumpIR it is probably not worth fixing it now and it probably should be deleted

I also agree to deprecate JitDumpIR.

Cheers,
Leslie Zhai

I suggest you to use COMPLUS_JitDump variable instead

JitDump failed to work for the testcase JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128_r/ConvertToVector128_r.exe. Sorry for that! @QiaoVanke and I are fixing it for MIPS64. So I just use JitDumpIR temporarily.

How about ildasm?

$ ./bin/Product/Linux.mips64.Debug/ildasm bin/Product/Linux.mips64.Debug/System.Private.CoreLib.dll &> System.Private.CoreLib.il

Thanks,
Leslie Zhai

JitDump failed to work for the testcase JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128_r/ConvertToVector128_r.exe

Does it fail with something MIPS specific?

How about ildasm?

Doesn't it work for that test? How does it fail?

JitDump failed to work for the testcase JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128_r/ConvertToVector128_r.exe

Does it fail with something MIPS specific?

Yes, we refactoried the IG for MIPS64, so such as emitter::emitDispIG failed to work at present.

How about ildasm?

Doesn't it work for that test? How does it fail?

ildasm works for MIPS64
System.Private.CoreLib.il.zip

Cheers,
Leslie Zhai

This issue is resolved, so closing. I opened https://github.com/dotnet/runtime/issues/818 to cover the suggestion to remove JitDumpIR.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akoeplinger picture akoeplinger  路  207Comments

ghuntley picture ghuntley  路  158Comments

galvesribeiro picture galvesribeiro  路  185Comments

ebickle picture ebickle  路  318Comments

terrajobst picture terrajobst  路  158Comments