Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Apr 8, 2021
1 parent aec96ad commit 7f750ab
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7733,7 +7733,31 @@ GenTree* Compiler::fgMorphPotentialTailCall(GenTreeCall* call)
//
if (nextBlock->bbJumpKind != BBJ_RETURN)
{
BasicBlock* const nextNextBlock = nextBlock->GetUniqueSucc();
BasicBlock* nextNextBlock = nextBlock->GetUniqueSucc();

// Check if we have a sequence of GT_ASG blocks where the same variable is assigned to temps over
// and over (can happen after multiple GDVs of potential tall calls).
// TODO-CQ: Don't introduce new temps when we replace GT_RET_EXPR which is already assigned to a
// local.
if (nextNextBlock->bbJumpKind != BBJ_RETURN)
{
assert(nextBlock->firstStmt() == nextBlock->lastStmt());
GenTree* asgNode = nextBlock->firstStmt()->GetRootNode();
assert(asgNode->OperIs(GT_ASG));

unsigned lcl = asgNode->gtGetOp1()->AsLclVarCommon()->GetLclNum();

while (nextNextBlock->bbJumpKind != BBJ_RETURN)
{
assert(nextNextBlock->firstStmt() == nextNextBlock->lastStmt());
asgNode = nextNextBlock->firstStmt()->GetRootNode();
assert(asgNode->OperIs(GT_ASG));
assert(lcl == asgNode->gtGetOp2()->AsLclVarCommon()->GetLclNum());
lcl = asgNode->gtGetOp1()->AsLclVarCommon()->GetLclNum();
nextNextBlock = nextNextBlock->GetUniqueSucc();
}
}

assert(nextNextBlock->bbJumpKind == BBJ_RETURN);

if (nextNextBlock->hasProfileWeight())
Expand Down

0 comments on commit 7f750ab

Please sign in to comment.