Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 29499d1

Browse files
committed
Improve the dump for inline return expressions
Also don't do a deep copy of the inline return expression
1 parent ce97aac commit 29499d1

File tree

1 file changed

+23
-29
lines changed

1 file changed

+23
-29
lines changed

src/jit/flowgraph.cpp

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21584,38 +21584,32 @@ Compiler::fgWalkResult Compiler::fgUpdateInlineReturnExpressionPlaceHolder(
2158421584
: NO_CLASS_HANDLE;
2158521585
#endif // defined(FEATURE_HFA) || defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
2158621586

21587-
2158821587
do
2158921588
{
2159021589
// Obtained the expanded inline candidate
21591-
GenTreePtr inlineCandidate;
21592-
21593-
inlineCandidate = tree->gtRetExpr.gtInlineCandidate;
21590+
GenTreePtr inlineCandidate = tree->gtRetExpr.gtInlineCandidate;
2159421591

21595-
// If the inlineCandidate node is a leaf, we can just overwrite "tree" with it.
21596-
// But if it's not, we have to make sure to do a deep copy before overwriting it.
21597-
if (inlineCandidate->OperIsLeaf())
21592+
#ifdef DEBUG
21593+
if (comp->verbose)
2159821594
{
21599-
tree->CopyFrom(inlineCandidate, comp);
21595+
printf("\nReplacing the return expression placeholder ");
21596+
printTreeID(tree);
21597+
printf(" with ");
21598+
printTreeID(inlineCandidate);
21599+
printf("\n");
21600+
// Dump out the old return expression placeholder it will be overwritten by the CopyFrom below
21601+
comp->gtDispTree(tree);
2160021602
}
21601-
else
21602-
{
21603-
tree->CopyFrom(comp->gtCloneExpr(inlineCandidate), comp);
21604-
#ifdef DEBUG
21605-
comp->CopyTestDataToCloneTree(inlineCandidate, tree);
2160621603
#endif // DEBUG
21607-
}
21604+
21605+
tree->CopyFrom(inlineCandidate, comp);
2160821606

2160921607
#ifdef DEBUG
21610-
if (false && comp->verbose)
21608+
if (comp->verbose)
2161121609
{
21612-
21613-
printf("\nAfter updating the return expression place holder ");
21614-
printTreeID(tree);
21615-
printf(" for call ");
21616-
printTreeID(inlineCandidate);
21617-
printf(":\n");
21610+
printf("\nInserting the inline return expression\n");
2161821611
comp->gtDispTree(tree);
21612+
printf("\n");
2161921613
}
2162021614
#endif // DEBUG
2162121615
}
@@ -21927,9 +21921,9 @@ void Compiler::fgInvokeInlineeCompiler(GenTreeCall* call,
2192721921
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2192821922
void Compiler::fgInsertInlineeBlocks(InlineInfo* pInlineInfo)
2192921923
{
21930-
GenTreePtr iciCall = pInlineInfo->iciCall;
21931-
GenTreePtr iciStmt = pInlineInfo->iciStmt;
21932-
BasicBlock* iciBlock = pInlineInfo->iciBlock;
21924+
GenTreePtr iciCall = pInlineInfo->iciCall;
21925+
GenTreePtr iciStmt = pInlineInfo->iciStmt;
21926+
BasicBlock* iciBlock = pInlineInfo->iciBlock;
2193321927
BasicBlock* block;
2193421928

2193521929
// We can write better assert here. For example, we can check that
@@ -22225,17 +22219,17 @@ void Compiler::fgInsertInlineeBlocks(InlineInfo* pInlineInfo)
2222522219
if ((pInlineInfo->inlineCandidateInfo->fncRetType != TYP_VOID) || (iciCall->gtCall.gtReturnType == TYP_STRUCT))
2222622220
{
2222722221
noway_assert(pInlineInfo->retExpr);
22228-
iciCall->CopyFrom(pInlineInfo->retExpr, this);
22229-
2223022222
#ifdef DEBUG
2223122223
if (verbose)
2223222224
{
22233-
printf("\nReturn expression for inlinee ");
22225+
printf("\nReturn expression for call at ");
2223422226
printTreeID(iciCall);
22235-
printf(" :\n");
22236-
gtDispTree(iciCall);
22227+
printf(" is\n");
22228+
gtDispTree(pInlineInfo->retExpr);
2223722229
}
2223822230
#endif // DEBUG
22231+
// Replace the call with the return expression
22232+
iciCall->CopyFrom(pInlineInfo->retExpr, this);
2223922233
}
2224022234

2224122235
//

0 commit comments

Comments
 (0)