Skip to content

Commit

Permalink
Make optVNAssertionPropCurStmtVisitor post-order (#78630)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Nov 21, 2022
1 parent 4f0f5b5 commit 1ab2c4a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6054,7 +6054,7 @@ GenTree* Compiler::optVNConstantPropOnJTrue(BasicBlock* block, GenTree* test)
// Performs constant prop on the current statement's tree nodes.
//
// Assumption:
// This function is called as part of a pre-order tree walk.
// This function is called as part of a post-order tree walk.
//
// Arguments:
// tree - The currently visited tree node.
Expand Down Expand Up @@ -6128,7 +6128,7 @@ Compiler::fgWalkResult Compiler::optVNConstantPropCurStmt(BasicBlock* block, Sta
// Don't transform long multiplies.
if (tree->gtFlags & GTF_MUL_64RSLT)
{
return WALK_SKIP_SUBTREES;
return WALK_CONTINUE;
}
break;

Expand Down Expand Up @@ -6166,16 +6166,15 @@ Compiler::fgWalkResult Compiler::optVNConstantPropCurStmt(BasicBlock* block, Sta
return WALK_CONTINUE;
}

// Successful propagation, mark as assertion propagated and skip
// sub-tree (with side-effects) visits.
// TODO #18291: at that moment stmt could be already removed from the stmt list.
// TODO https://github.com/dotnet/runtime/issues/10450:
// at that moment stmt could be already removed from the stmt list.

optAssertionProp_Update(newTree, tree, stmt);

JITDUMP("After constant propagation on [%06u]:\n", tree->gtTreeID);
DBEXEC(VERBOSE, gtDispStmt(stmt));

return WALK_SKIP_SUBTREES;
return WALK_CONTINUE;
}

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -6222,7 +6221,7 @@ void Compiler::optVnNonNullPropCurStmt(BasicBlock* block, Statement* stmt, GenTr
// Unified Value Numbering based assertion propagation visitor.
//
// Assumption:
// This function is called as part of a pre-order tree walk.
// This function is called as part of a post-order tree walk.
//
// Return Value:
// WALK_RESULTs.
Expand Down Expand Up @@ -6269,7 +6268,7 @@ Statement* Compiler::optVNAssertionPropCurStmt(BasicBlock* block, Statement* stm
optAssertionPropagatedCurrentStmt = false;

VNAssertionPropVisitorInfo data(this, block, stmt);
fgWalkTreePre(stmt->GetRootNodePointer(), Compiler::optVNAssertionPropCurStmtVisitor, &data);
fgWalkTreePost(stmt->GetRootNodePointer(), Compiler::optVNAssertionPropCurStmtVisitor, &data);

if (optAssertionPropagatedCurrentStmt)
{
Expand Down

0 comments on commit 1ab2c4a

Please sign in to comment.