Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: revise inlinee scale computations #51593

Merged
merged 1 commit into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5706,7 +5706,7 @@ class Compiler

void WalkSpanningTree(SpanningTreeVisitor* visitor);
void fgSetProfileWeight(BasicBlock* block, BasicBlock::weight_t weight);
void fgComputeProfileScale();
void fgApplyProfileScale();

// fgIsUsingProfileWeights - returns true if we have real profile data for this method
// or if we have some fake profile data for the stress mode
Expand Down
40 changes: 3 additions & 37 deletions src/coreclr/jit/fginline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,8 +881,6 @@ void Compiler::fgInvokeInlineeCompiler(GenTreeCall* call, InlineResult* inlineRe
inlineInfo.retExprClassHnd = nullptr;
inlineInfo.retExprClassHndIsExact = false;
inlineInfo.inlineResult = inlineResult;
inlineInfo.profileScaleState = InlineInfo::ProfileScaleState::UNDETERMINED;
inlineInfo.profileScaleFactor = 0.0;
#ifdef FEATURE_SIMD
inlineInfo.hasSIMDTypeArgLocalOrReturn = false;
#endif // FEATURE_SIMD
Expand Down Expand Up @@ -1274,10 +1272,6 @@ void Compiler::fgInsertInlineeBlocks(InlineInfo* pInlineInfo)
//
// Set the try and handler index and fix the jump types of inlinee's blocks.
//

bool inheritWeight;
inheritWeight = true; // The firstBB does inherit the weight from the iciBlock

for (block = InlineeCompiler->fgFirstBB; block != nullptr; block = block->bbNext)
{
noway_assert(!block->hasTryIndex());
Expand All @@ -1299,48 +1293,20 @@ void Compiler::fgInsertInlineeBlocks(InlineInfo* pInlineInfo)

if (block->bbJumpKind == BBJ_RETURN)
{
inheritWeight = true; // A return block does inherit the weight from the iciBlock
noway_assert((block->bbFlags & BBF_HAS_JMP) == 0);
if (block->bbNext)
{
JITDUMP("\nConvert bbJumpKind of " FMT_BB " to BBJ_ALWAYS to bottomBlock " FMT_BB "\n", block->bbNum,
bottomBlock->bbNum);
block->bbJumpKind = BBJ_ALWAYS;
block->bbJumpDest = bottomBlock;
#ifdef DEBUG
if (verbose)
{
printf("\nConvert bbJumpKind of " FMT_BB " to BBJ_ALWAYS to bottomBlock " FMT_BB "\n", block->bbNum,
bottomBlock->bbNum);
}
#endif // DEBUG
}
else
{
#ifdef DEBUG
if (verbose)
{
printf("\nConvert bbJumpKind of " FMT_BB " to BBJ_NONE\n", block->bbNum);
}
#endif // DEBUG
JITDUMP("\nConvert bbJumpKind of " FMT_BB " to BBJ_NONE\n", block->bbNum);
block->bbJumpKind = BBJ_NONE;
}
}

// Update profile weight for callee blocks, if we didn't do it already.
if (pInlineInfo->profileScaleState == InlineInfo::ProfileScaleState::KNOWN)
{
continue;
}

// If we were unable to compute a scale for some reason, then
// try to do something plausible. Entry/exit blocks match call
// site, internal blocks scaled by half; all rare blocks left alone.
//
if (!block->isRunRarely())
{
block->inheritWeightPercentage(iciBlock, inheritWeight ? 100 : 50);
}

inheritWeight = false;
}

// Insert inlinee's blocks into inliner's block list.
Expand Down
Loading