From: Andy Ayers Date: Tue, 11 Dec 2018 22:59:29 +0000 (-0800) Subject: JIT: capture failing inline observation in more cases (dotnet/coreclr#21471) X-Git-Tag: submit/tizen/20210909.063632~11030^2~3088 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2374141bed23ddc315eae0cbf07003772dd7b4c;p=platform%2Fupstream%2Fdotnet%2Fruntime.git JIT: capture failing inline observation in more cases (dotnet/coreclr#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. Commit migrated from https://github.com/dotnet/coreclr/commit/fc90b973bf806410b836541a3d0af2293152c787 --- diff --git a/src/coreclr/src/jit/inline.cpp b/src/coreclr/src/jit/inline.cpp index f523d2a..6bc8482 100644 --- a/src/coreclr/src/jit/inline.cpp +++ b/src/coreclr/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