Skip to content

VN based copy prop assertion when enabling debug #77380

@a74nh

Description

@a74nh

Description

Arm64 Linux (Not sure about other targets).

Enabling COMPlus_JitDump for System.SpanHelpers:IndexOfNullCharacter
I get the following error:

Assert failure(PID 653538 [0x0009f8e2], Thread: 653538 [0x9f8e2]): Assertion failed '(m_array <= ssaDef) && (ssaDef < &m_array[m_count])' in 'System.SpanHelpers:IndexOfNullCharacter(byref):int' during 'VN based copy prop' (IL size 569; hash 0x1a78949a; Tier1)

Reproduction Steps

Simplest way to reproduce:

export COMPlus_JitDump=*
corerun helloworld.dll

Expected behavior

No assert failures

Actual behavior

dump_vn.txt

Assert failure(PID 655393 [0x000a0021], Thread: 655393 [0xa0021]): Assertion failed '(m_array <= ssaDef) && (ssaDef < &m_array[m_count])' in 'System.SpanHelpers:IndexOfNullCharacter(byref):int' during 'VN based copy prop' (IL size 569; hash 0x1a78949a; Tier1)

    File: /home/alahay01/dotnet/runtime_ccmp/src/coreclr/jit/compiler.h Line: 378
    Image: /home/alahay01/dotnet/runtime_ccmp/artifacts/bin/coreclr/Linux.arm64.Checked/corerun

Regression?

Used to work for me.

Known Workarounds

diff --git a/src/coreclr/jit/copyprop.cpp b/src/coreclr/jit/copyprop.cpp
index d029c8f3dce..1b859036eea 100644
--- a/src/coreclr/jit/copyprop.cpp
+++ b/src/coreclr/jit/copyprop.cpp
@@ -79,9 +79,9 @@ void Compiler::optDumpCopyPropStack(LclNumToLiveDefsMap* curSsaName)
     {
         GenTreeLclVarCommon* lclDefNode = iter.GetValue()->Top().GetDefNode()->AsLclVarCommon();
         unsigned             defLclNum  = iter.Get();
-        unsigned             defSsaNum  = lvaGetDesc(defLclNum)->GetSsaNumForSsaDef(iter.GetValue()->Top().GetSsaDef());
+        // unsigned             defSsaNum  = lvaGetDesc(defLclNum)->GetSsaNumForSsaDef(iter.GetValue()->Top().GetSsaDef());

-        JITDUMP("[%06d]:V%02u/%u ", dspTreeID(lclDefNode), defLclNum, defSsaNum);
+        JITDUMP("[%06d]:V%02u/%u ", dspTreeID(lclDefNode), defLclNum, 0);
     }
     JITDUMP("}\n\n");
 }

Configuration

Linux Arm64 Ubuntu 18.04

e232f79 2022-10-24.. Jan Kotas Temporary instrumentation for #76280 (#77365)

Other information

No response

Metadata

Metadata

Labels

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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions