Skip to content

Commit

Permalink
Don't inline calls inside rarely used (cold) basic blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Sep 7, 2020
1 parent b3bc0a7 commit 5e02b19
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/coreclr/src/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20117,6 +20117,20 @@ void Compiler::impMarkInlineCandidateHelper(GenTreeCall* call,

if (!(methAttr & CORINFO_FLG_FORCEINLINE))
{

if (compCurBB->isRunRarely())
{
#ifdef DEBUG
if (verbose)
{
printf("\nWill not inline calls in cold basic blocks\n");
}
#endif

inlineResult.NoteFatal(InlineObservation::CALLSITE_IS_WITHIN_COLD_BLOCK);
return;
}

/* Don't bother inline blocks that are in the filter region */
if (bbInCatchHandlerILRange(compCurBB))
{
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/src/jit/inline.def
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ INLINE_OBSERVATION(IS_TOO_DEEP, bool, "too deep",
INLINE_OBSERVATION(IS_VIRTUAL, bool, "virtual", FATAL, CALLSITE)
INLINE_OBSERVATION(IS_VM_NOINLINE, bool, "noinline per VM", FATAL, CALLSITE)
INLINE_OBSERVATION(IS_WITHIN_CATCH, bool, "within catch region", FATAL, CALLSITE)
INLINE_OBSERVATION(IS_WITHIN_COLD_BLOCK, bool, "within cold block", FATAL, CALLSITE)
INLINE_OBSERVATION(IS_WITHIN_FILTER, bool, "within filter region", FATAL, CALLSITE)
INLINE_OBSERVATION(LDARGA_NOT_LOCAL_VAR, bool, "ldarga not on local var", FATAL, CALLSITE)
INLINE_OBSERVATION(LDFLD_NEEDS_HELPER, bool, "ldfld needs helper", FATAL, CALLSITE)
Expand Down

0 comments on commit 5e02b19

Please sign in to comment.