From 3f50950fc759bf122cc3478ec618d1dbec412377 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Wed, 10 Mar 2021 08:56:57 -0800 Subject: [PATCH 1/2] Change prejit instrumentation default back to block profiling Both crossgen1 and crossgen2 currently reject schemas that contain edge profile counters. Change the jit defaults back to block profiling when prejitting. See notes in #49267. --- src/coreclr/jit/fgprofile.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/coreclr/jit/fgprofile.cpp b/src/coreclr/jit/fgprofile.cpp index e81d61c2398c7a..d985c160a346dc 100644 --- a/src/coreclr/jit/fgprofile.cpp +++ b/src/coreclr/jit/fgprofile.cpp @@ -1489,7 +1489,7 @@ PhaseStatus Compiler::fgPrepareToInstrumentMethod() // // We enable edge profiling by default, except when: // * disabled by option - // * we are prejitting via classic ngen + // * we are prejitting // * we are jitting osr methods // // Currently, OSR is incompatible with edge profiling. So if OSR is enabled, @@ -1500,15 +1500,9 @@ PhaseStatus Compiler::fgPrepareToInstrumentMethod() // CLANG_FORMAT_COMMENT_ANCHOR; -#ifdef FEATURE_READYTORUN_COMPILER - const bool r2r = opts.IsReadyToRun(); -#else - const bool r2r = false; -#endif - const bool prejit = opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT); - const bool classicNgen = prejit && !r2r; - const bool osr = (opts.jitFlags->IsSet(JitFlags::JIT_FLAG_TIER0) && (JitConfig.TC_OnStackReplacement() > 0)); - const bool useEdgeProfiles = (JitConfig.JitEdgeProfiling() > 0) && !classicNgen && !osr; + const bool prejit = opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT); + const bool osr = (opts.jitFlags->IsSet(JitFlags::JIT_FLAG_TIER0) && (JitConfig.TC_OnStackReplacement() > 0)); + const bool useEdgeProfiles = (JitConfig.JitEdgeProfiling() > 0) && !prejit && !osr; if (useEdgeProfiles) { From 6073e1fe8b32f5c50309df412efc77f525550a4c Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Wed, 10 Mar 2021 10:57:30 -0800 Subject: [PATCH 2/2] fix dump message --- src/coreclr/jit/fgprofile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/jit/fgprofile.cpp b/src/coreclr/jit/fgprofile.cpp index d985c160a346dc..f32137f1404e68 100644 --- a/src/coreclr/jit/fgprofile.cpp +++ b/src/coreclr/jit/fgprofile.cpp @@ -1511,7 +1511,7 @@ PhaseStatus Compiler::fgPrepareToInstrumentMethod() else { JITDUMP("Using block profiling, because %s\n", - (JitConfig.JitEdgeProfiling() > 0) ? "edge profiles disabled" : classicNgen ? "classic Ngen" : "OSR"); + (JitConfig.JitEdgeProfiling() > 0) ? "edge profiles disabled" : prejit ? "prejitting" : "OSR"); fgCountInstrumentor = new (this, CMK_Pgo) BlockCountInstrumentor(this); }