Skip to content
Open
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
17 changes: 17 additions & 0 deletions src/coreclr/jit/fgdiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3929,6 +3929,7 @@ void Compiler::fgDebugCheckLinks(bool morphTrees)
// - all statements in the block are linked correctly
// - check statements flags
// - check nodes gtNext and gtPrev values, if the node list is threaded
// - no invalid statements given the block kind
//
// Arguments:
// block - the block to check statements in
Expand Down Expand Up @@ -3965,6 +3966,22 @@ void Compiler::fgDebugCheckStmtsList(BasicBlock* block, bool morphTrees)
noway_assert(block->lastStmt() == stmt);
}

// Block that isn't BBJ_RETURN should not contain GT_RETURN node.
if (!block->KindIs(BBJ_RETURN))
{
GenTree* tree = stmt->GetRootNode();
assert(!tree->OperIs(GT_RETURN) && "GT_RETURN node found in a block that isn't BBJ_RETURN");
}

// If the block contains a GT_RETURN node it should be last.
if (block->KindIs(BBJ_RETURN))
{
GenTree* tree = stmt->GetRootNode();
bool isReturn = tree->OperIs(GT_RETURN);
bool isNotLastStmt = stmt->GetNextStmt() != nullptr;
assert(!(isReturn && isNotLastStmt) && "GT_RETURN node found that is not the last statement in the block");
}

// For each statement check that the exception flags are properly set

noway_assert(stmt->GetRootNode());
Expand Down
Loading