Skip to content
Merged
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
19 changes: 17 additions & 2 deletions src/coreclr/jit/fgdiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3940,6 +3940,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 @@ -3977,12 +3978,26 @@ void Compiler::fgDebugCheckStmtsList(BasicBlock* block, bool morphTrees)
}

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

noway_assert(stmt->GetRootNode());

fgDebugCheckFlags(stmt->GetRootNode(), block);
fgDebugCheckTypes(stmt->GetRootNode());

// 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");
}
Comment thread
jakobbotsch marked this conversation as resolved.
Comment thread
jakobbotsch marked this conversation as resolved.

// Not only will this stress fgMorphBlockStmt(), but we also get all the checks
// done by fgMorphTree()

Expand Down
Loading