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

Fix issues with early dumps of multi-reg-returning calls. #12843

Merged
merged 3 commits into from
Jul 18, 2017
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
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