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

Use fgUpdateConstTreeValueNumber where appropriate #103771

Merged
merged 1 commit into from
Jun 20, 2024
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
31 changes: 6 additions & 25 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15923,10 +15923,7 @@ GenTree* Compiler::gtFoldExprConst(GenTree* tree)

// Fold into GT_IND of null byref.
tree->BashToConst(0, TYP_BYREF);
if (vnStore != nullptr)
{
fgValueNumberTreeConst(tree);
}
fgUpdateConstTreeValueNumber(tree);

JITDUMP("\nFolded to null byref:\n");
DISPTREE(tree);
Expand Down Expand Up @@ -16128,10 +16125,7 @@ GenTree* Compiler::gtFoldExprConst(GenTree* tree)
tree->BashToConst(static_cast<int>(i1));
tree->AsIntCon()->gtFieldSeq = fieldSeq;

if (vnStore != nullptr)
{
fgValueNumberTreeConst(tree);
}
fgUpdateConstTreeValueNumber(tree);

JITDUMP("Bashed to int constant:\n");
DISPTREE(tree);
Expand Down Expand Up @@ -16351,10 +16345,7 @@ GenTree* Compiler::gtFoldExprConst(GenTree* tree)
#ifdef TARGET_64BIT
tree->AsIntCon()->gtFieldSeq = fieldSeq;
#endif
if (vnStore != nullptr)
{
fgValueNumberTreeConst(tree);
}
fgUpdateConstTreeValueNumber(tree);

JITDUMP("Bashed to long constant:\n");
DISPTREE(tree);
Expand Down Expand Up @@ -16509,10 +16500,7 @@ GenTree* Compiler::gtFoldExprConst(GenTree* tree)
(tree->gtDebugFlags & GTF_DEBUG_NODE_LARGE));

tree->BashToConst(d1, tree->TypeGet());
if (vnStore != nullptr)
{
fgValueNumberTreeConst(tree);
}
fgUpdateConstTreeValueNumber(tree);

JITDUMP("Bashed to fp constant:\n");
DISPTREE(tree);
Expand Down Expand Up @@ -29699,13 +29687,9 @@ GenTree* Compiler::gtFoldExprHWIntrinsic(GenTreeHWIntrinsic* tree)
if (fgGlobalMorph)
{
INDEBUG(vecCon->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED);
;
}

if (vnStore != nullptr)
{
fgValueNumberTreeConst(vecCon);
}
fgUpdateConstTreeValueNumber(vecCon);
return vecCon;
}

Expand Down Expand Up @@ -30630,10 +30614,7 @@ GenTree* Compiler::gtFoldExprHWIntrinsic(GenTreeHWIntrinsic* tree)

if (resultNode->OperIsConst())
{
if (vnStore != nullptr)
{
fgValueNumberTreeConst(resultNode);
}
fgUpdateConstTreeValueNumber(resultNode);

// Make sure no side effect flags are set on this constant node.
resultNode->gtFlags &= ~GTF_ALL_EFFECT;
Expand Down
11 changes: 3 additions & 8 deletions src/coreclr/jit/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3320,10 +3320,7 @@ bool Compiler::optNarrowTree(GenTree* tree, var_types srct, var_types dstt, Valu
if (doit)
{
tree->BashToConst(static_cast<int32_t>(lval));
if (vnStore != nullptr)
{
fgValueNumberTreeConst(tree);
}
fgUpdateConstTreeValueNumber(tree);
}

return true;
Expand Down Expand Up @@ -3372,10 +3369,8 @@ bool Compiler::optNarrowTree(GenTree* tree, var_types srct, var_types dstt, Valu
{
tree->gtType = TYP_INT;
tree->AsIntCon()->gtIconVal = (int)ival;
if (vnStore != nullptr)
{
fgValueNumberTreeConst(tree);
}

fgUpdateConstTreeValueNumber(tree);
}
#endif // TARGET_64BIT

Expand Down
Loading