Skip to content
Closed
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
10 changes: 1 addition & 9 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3045,7 +3045,7 @@ GenTree* Compiler::optVNBasedFoldConstExpr(BasicBlock* block, GenTree* parent, G

// Were able to optimize.
conValTree->gtVNPair = vnPair;
return gtWrapWithSideEffects(conValTree, tree, GTF_SIDE_EFFECT, true);
return gtWrapWithSideEffects(conValTree, tree, GTF_SIDE_EFFECT);
}
else
{
Expand Down Expand Up @@ -5486,14 +5486,6 @@ GenTree* Compiler::optAssertionProp_Update(GenTree* newTree, GenTree* tree, Stat
assert((stmt->GetRootNode() == tree) && (stmt->GetRootNodePointer() == useEdge));
stmt->SetRootNode(newTree);
}

// We only need to ensure that the gtNext field is set as it is used to traverse
// to the next node in the tree. We will re-morph this entire statement in
// optAssertionPropMain(). It will reset the gtPrev and gtNext links for all nodes.
newTree->gtNext = tree->gtNext;

// Old tree should not be referenced anymore.
DEBUG_DESTROY_NODE(tree);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10515,7 +10515,7 @@ var_types Compiler::gtTypeForNullCheck(GenTree* tree)
//
void Compiler::gtChangeOperToNullCheck(GenTree* tree, BasicBlock* block)
{
assert(tree->OperIs(GT_IND, GT_BLK));
assert(tree->OperIs(GT_IND, GT_BLK, GT_ARR_LENGTH));
tree->ChangeOper(GT_NULLCHECK);
tree->ChangeType(gtTypeForNullCheck(tree));
tree->SetIndirExceptionFlags(this);
Expand Down
8 changes: 2 additions & 6 deletions src/coreclr/jit/fgopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1716,8 +1716,8 @@ bool Compiler::fgOptimizeSwitchBranches(BasicBlock* block)
if (switchTree->gtFlags & GTF_SIDE_EFFECT)
{
/* Extract the side effects from the conditional */
compCurBB = block;
GenTree* sideEffList = nullptr;

gtExtractSideEffList(switchTree, &sideEffList);

if (sideEffList == nullptr)
Expand Down Expand Up @@ -2414,13 +2414,12 @@ void Compiler::fgRemoveConditionalJump(BasicBlock* block)
if (cond->gtFlags & GTF_SIDE_EFFECT)
{
/* Extract the side effects from the conditional */
compCurBB = block;
GenTree* sideEffList = nullptr;

gtExtractSideEffList(cond, &sideEffList);

if (sideEffList == nullptr)
{
compCurBB = block;
fgRemoveStmt(block, condStmt);
}
else
Expand All @@ -2444,8 +2443,6 @@ void Compiler::fgRemoveConditionalJump(BasicBlock* block)

if (fgNodeThreading == NodeThreading::AllTrees)
{
compCurBB = block;

/* Update ordering, costs, FP levels, etc. */
gtSetStmtInfo(condStmt);

Expand All @@ -2456,7 +2453,6 @@ void Compiler::fgRemoveConditionalJump(BasicBlock* block)
}
else
{
compCurBB = block;
/* conditional has NO side effect - remove it */
fgRemoveStmt(block, condStmt);
}
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17370,9 +17370,9 @@ void Compiler::gtExtractSideEffList(GenTree* expr,

if (m_compiler->gtNodeHasSideEffects(node, m_flags))
{
if (node->OperIsBlk() && !node->OperIsStoreBlk())
if (node->OperIs(GT_ARR_LENGTH) || (node->OperIsBlk() && !node->OperIsStoreBlk()))
{
JITDUMP("Replace an unused BLK node [%06d] with a NULLCHECK\n", dspTreeID(node));
JITDUMP("Replace an unused node [%06d] with a NULLCHECK\n", dspTreeID(node));
m_compiler->gtChangeOperToNullCheck(node, m_compiler->compCurBB);
}

Expand Down
Loading