From 755d5e99c0d80a09e49cd86fb95fe1d3bb7cce30 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Tue, 26 Jan 2021 09:34:55 -0800 Subject: [PATCH] JIT: run instrumentation phase just after importing As a prerequisite to enabling efficient instrumentation, add instrumentation immediately after importing, so the flow graph more closely reflects the IL level view. --- src/coreclr/jit/compiler.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index efdf66d864b35..036642e254f2b 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -4420,6 +4420,13 @@ void Compiler::compCompile(void** methodCodePtr, ULONG* methodCodeSize, JitFlags // DoPhase(this, PHASE_IMPORTATION, &Compiler::fgImport); + // If instrumenting, add block and class probes. + // + if (compileFlags->IsSet(JitFlags::JIT_FLAG_BBINSTR)) + { + DoPhase(this, PHASE_IBCINSTR, &Compiler::fgInstrumentMethod); + } + // Transform indirect calls that require control flow expansion. // DoPhase(this, PHASE_INDXCALL, &Compiler::fgTransformIndirectCalls); @@ -4494,11 +4501,6 @@ void Compiler::compCompile(void** methodCodePtr, ULONG* methodCodeSize, JitFlags fgRemoveEH(); #endif // !FEATURE_EH - if (compileFlags->IsSet(JitFlags::JIT_FLAG_BBINSTR)) - { - DoPhase(this, PHASE_IBCINSTR, &Compiler::fgInstrumentMethod); - } - // We could allow ESP frames. Just need to reserve space for // pushing EBP if the method becomes an EBP-frame after an edit. // Note that requiring a EBP Frame disallows double alignment. Thus if we change this