From a7e416f4f25e26b3942093d3a4fb5f214dfe925b Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Thu, 27 Oct 2016 11:15:25 -0700 Subject: [PATCH] Inliner: Fix LegacyPolicyAssert; Dump prejit noinline reasons The LegacyPolicy does not do the no-return deduction, so if it's active, skip the validating assert in `fgFindBasicBlocks`. When tracing inlines, dump the reason why a prejit root can't be inlined, so it's easier to track this down later. Commit migrated from https://github.com/dotnet/coreclr/commit/60081d1b716a5509c36da6d4c8b67888f1460db9 --- src/coreclr/src/jit/flowgraph.cpp | 17 +++++++++++++---- src/coreclr/src/jit/inline.cpp | 13 ++++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/coreclr/src/jit/flowgraph.cpp b/src/coreclr/src/jit/flowgraph.cpp index b8a46a7..69710a7 100644 --- a/src/coreclr/src/jit/flowgraph.cpp +++ b/src/coreclr/src/jit/flowgraph.cpp @@ -5748,10 +5748,19 @@ void Compiler::fgFindBasicBlocks() if (compIsForInlining()) { - // If fgFindJumpTargets marked this as "no return" there really should be no BBJ_RETURN blocks in the method - assert((retBlocks == 0 && ((impInlineInfo->iciCall->gtCallMoreFlags & GTF_CALL_M_DOES_NOT_RETURN) == - GTF_CALL_M_DOES_NOT_RETURN)) || - (retBlocks >= 1 && ((impInlineInfo->iciCall->gtCallMoreFlags & GTF_CALL_M_DOES_NOT_RETURN) == 0))); + +#ifdef DEBUG + // If fgFindJumpTargets marked the call as "no return" there + // really should be no BBJ_RETURN blocks in the method. + // + // Note LegacyPolicy does not mark calls as no return, so if + // it's active, skip the check. + if (!compInlineResult->UsesLegacyPolicy()) + { + bool markedNoReturn = (impInlineInfo->iciCall->gtCallMoreFlags & GTF_CALL_M_DOES_NOT_RETURN) != 0; + assert((markedNoReturn && (retBlocks == 0)) || (!markedNoReturn && (retBlocks >= 1))); + } +#endif // DEBUG if (compInlineResult->IsFailure()) { diff --git a/src/coreclr/src/jit/inline.cpp b/src/coreclr/src/jit/inline.cpp index deccc0e..b133bd7 100644 --- a/src/coreclr/src/jit/inline.cpp +++ b/src/coreclr/src/jit/inline.cpp @@ -646,10 +646,11 @@ void InlineResult::Report() m_Reported = true; #ifdef DEBUG - const char* callee = nullptr; + const char* callee = nullptr; + const bool showInlines = (JitConfig.JitPrintInlinedMethods() == 1); // Optionally dump the result - if (VERBOSE) + if (VERBOSE || showInlines) { const char* format = "INLINER: during '%s' result '%s' reason '%s' for '%s' calling '%s'\n"; const char* caller = (m_Caller == nullptr) ? "n/a" : m_RootCompiler->eeGetMethodFullName(m_Caller); @@ -689,12 +690,18 @@ void InlineResult::Report() #ifdef DEBUG + const char* obsString = InlGetObservationString(obs); + if (VERBOSE) { - const char* obsString = InlGetObservationString(obs); JITDUMP("\nINLINER: Marking %s as NOINLINE because of %s\n", callee, obsString); } + if (showInlines) + { + printf("Marking %s as NOINLINE because of %s\n", callee, obsString); + } + #endif // DEBUG COMP_HANDLE comp = m_RootCompiler->info.compCompHnd; -- 2.7.4