Skip to content

Commit

Permalink
Use fgUpdateConstTreeValueNumber where appropriate (dotnet#103771)
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding authored and rzikm committed Jun 24, 2024
1 parent 50458c6 commit ca96b97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 33 deletions.
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

0 comments on commit ca96b97

Please sign in to comment.