Skip to content

Commit 9b7b032

Browse files
authored
JIT: Check ISA directly when printing JitDisasm (dotnet#112828)
`compOpportunisticallyDependsOn` does a JIT-EE call that can otherwise make the compilation miss when `JitDisasm` is enabled.
1 parent 1d81756 commit 9b7b032

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/coreclr/jit/codegencommon.cpp

+15-12
Original file line numberDiff line numberDiff line change
@@ -1827,11 +1827,14 @@ void CodeGen::genGenerateMachineCode()
18271827
printf(" for ");
18281828

18291829
#if defined(TARGET_X86)
1830-
if (compiler->canUseEvexEncoding())
1830+
// Check ISA directly here instead of using
1831+
// compOpportunisticallyDependsOn to avoid JIT-EE calls that could make
1832+
// us miss in SPMI
1833+
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_EVEX))
18311834
{
1832-
if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v2))
1835+
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v2))
18331836
{
1834-
if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v2_V512))
1837+
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v2_V512))
18351838
{
18361839
printf("X86 with AVX10.2/512");
18371840
}
@@ -1840,9 +1843,9 @@ void CodeGen::genGenerateMachineCode()
18401843
printf("X86 with AVX10.2/256");
18411844
}
18421845
}
1843-
else if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v1))
1846+
else if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v1))
18441847
{
1845-
if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v1_V512))
1848+
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v1_V512))
18461849
{
18471850
printf("X86 with AVX10.1/512");
18481851
}
@@ -1857,7 +1860,7 @@ void CodeGen::genGenerateMachineCode()
18571860
printf("X86 with AVX512");
18581861
}
18591862
}
1860-
else if (compiler->canUseVexEncoding())
1863+
else if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX))
18611864
{
18621865
printf("X86 with AVX");
18631866
}
@@ -1866,11 +1869,11 @@ void CodeGen::genGenerateMachineCode()
18661869
printf("generic X86");
18671870
}
18681871
#elif defined(TARGET_AMD64)
1869-
if (compiler->canUseEvexEncoding())
1872+
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_EVEX))
18701873
{
1871-
if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v2))
1874+
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v2))
18721875
{
1873-
if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v2_V512))
1876+
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v2_V512))
18741877
{
18751878
printf("X64 with AVX10.2/512");
18761879
}
@@ -1879,9 +1882,9 @@ void CodeGen::genGenerateMachineCode()
18791882
printf("X64 with AVX10.2/256");
18801883
}
18811884
}
1882-
else if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v1))
1885+
else if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v1))
18831886
{
1884-
if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v1_V512))
1887+
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v1_V512))
18851888
{
18861889
printf("X64 with AVX10.1/512");
18871890
}
@@ -1896,7 +1899,7 @@ void CodeGen::genGenerateMachineCode()
18961899
printf("X64 with AVX512");
18971900
}
18981901
}
1899-
else if (compiler->canUseVexEncoding())
1902+
else if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX))
19001903
{
19011904
printf("X64 with AVX");
19021905
}

0 commit comments

Comments
 (0)