Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make optVNAssertionPropCurStmtVisitor post-order #78630

Merged
merged 1 commit into from
Nov 21, 2022
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
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