Skip to content
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
1 change: 1 addition & 0 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,7 @@ void CodeGen::genGenerateMachineCode()
{
compiler->opts.disAsm = true;
}
compiler->compCurBB = compiler->fgFirstBB;

if (compiler->opts.disAsm)
{
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5624,8 +5624,6 @@ GenTree* Compiler::fgMorphField(GenTree* tree, MorphAddrContext* mac)
GenTree* lclVar = gtNewLclvNode(lclNum, objRefType);
nullchk = gtNewNullCheck(lclVar, compCurBB);

nullchk->gtFlags |= GTF_DONT_CSE; // Don't try to create a CSE for these TYP_BYTE indirections

if (asg)
{
// Create the "comma" node.
Expand Down
9 changes: 9 additions & 0 deletions src/coreclr/jit/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6521,6 +6521,15 @@ void Compiler::optHoistLoopBlocks(unsigned loopNum, ArrayStack<BasicBlock*>* blo
{
return false;
}
else if (node->OperIs(GT_NULLCHECK))
{
// If a null-check is for `this` object, it is safe to
// hoist it out of the loop. Assrtionprop will get rid
// of left over nullchecks present inside the loop. Also,
// since NULLCHECK has no value, it will never be CSE,
// hence this check is not present in optIsCSEcandidate().
return true;
}

// Tree must be a suitable CSE candidate for us to be able to hoist it.
return m_compiler->optIsCSEcandidate(node);
Expand Down