Skip to content

Commit

Permalink
Merge pull request dotnet#12843 from pgavlin/FixEarlyMultiRegCallDumps
Browse files Browse the repository at this point in the history
Fix issues with early dumps of multi-reg-returning calls.
  • Loading branch information
pgavlin authored Jul 18, 2017
2 parents ee01749 + bf2b27c commit d992581
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9915,7 +9915,7 @@ void Compiler::gtDispRegVal(GenTree* tree)
// 0th reg is gtRegNum, which is already printed above.
// Print the remaining regs of a multi-reg call node.
GenTreeCall* call = tree->AsCall();
unsigned regCount = call->GetReturnTypeDesc()->GetReturnRegCount();
unsigned regCount = call->GetReturnTypeDesc()->TryGetReturnRegCount();
for (unsigned i = 1; i < regCount; ++i)
{
printf(",%s", compRegVarName(call->GetRegNumByIdx(i)));
Expand All @@ -9925,7 +9925,7 @@ void Compiler::gtDispRegVal(GenTree* tree)
{
GenTreeCopyOrReload* copyOrReload = tree->AsCopyOrReload();
GenTreeCall* call = tree->gtGetOp1()->AsCall();
unsigned regCount = call->GetReturnTypeDesc()->GetReturnRegCount();
unsigned regCount = call->GetReturnTypeDesc()->TryGetReturnRegCount();
for (unsigned i = 1; i < regCount; ++i)
{
printf(",%s", compRegVarName(copyOrReload->GetRegNumByIdx(i)));
Expand Down
9 changes: 9 additions & 0 deletions src/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -3171,6 +3171,15 @@ struct ReturnTypeDesc
#endif
}

#ifdef DEBUG
// NOTE: we only use this function when writing out IR dumps. These dumps may take place before the ReturnTypeDesc
// has been initialized.
unsigned TryGetReturnRegCount() const
{
return m_inited ? GetReturnRegCount() : 0;
}
#endif // DEBUG

//--------------------------------------------------------------------------------------------
// GetReturnRegCount: Get the count of return registers in which the return value is returned.
//
Expand Down

0 comments on commit d992581

Please sign in to comment.