From fc90b973bf806410b836541a3d0af2293152c787 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Tue, 11 Dec 2018 14:59:29 -0800 Subject: [PATCH] JIT: capture failing inline observation in more cases (#21471) We were not capturing failing inline observations for failed inlines that got reported by the runtime directly. Move the point of capture up in the jitted code so it always happens regardless of reporting obligations. --- src/jit/inline.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/jit/inline.cpp b/src/jit/inline.cpp index f523d2a..6bc8482 100644 --- a/src/jit/inline.cpp +++ b/src/jit/inline.cpp @@ -659,6 +659,22 @@ InlineResult::InlineResult(Compiler* compiler, CORINFO_METHOD_HANDLE method, con void InlineResult::Report() { + +#ifdef DEBUG + // If this is a failure of a specific inline candidate and we haven't captured + // a failing observation yet, do so now. + if (IsFailure() && (m_Call != nullptr)) + { + // compiler should have revoked candidacy on the call by now + assert((m_Call->gtFlags & GTF_CALL_INLINE_CANDIDATE) == 0); + + if (m_Call->gtInlineObservation == InlineObservation::CALLEE_UNUSED_INITIAL) + { + m_Call->gtInlineObservation = m_Policy->GetObservation(); + } + } +#endif // DEBUG + // If we weren't actually inlining, user may have suppressed // reporting via setReported(). If so, do nothing. if (m_Reported) @@ -682,17 +698,6 @@ void InlineResult::Report() JITDUMP(format, m_Description, ResultString(), ReasonString(), caller, callee); } - - // If the inline failed, leave information on the call so we can - // later recover what observation lead to the failure. - if (IsFailure() && (m_Call != nullptr)) - { - // compiler should have revoked candidacy on the call by now - assert((m_Call->gtFlags & GTF_CALL_INLINE_CANDIDATE) == 0); - - m_Call->gtInlineObservation = m_Policy->GetObservation(); - } - #endif // DEBUG // Was the result NEVER? If so we might want to propagate this to -- 2.7.4