Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Delete gtCompareTree
Unused.
  • Loading branch information
SingleAccretion committed Nov 13, 2021
commit 2c85769438df40fc004597be2fe7fd6a71672329
2 changes: 0 additions & 2 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3418,8 +3418,6 @@ class Compiler
// before they have been set.)
bool gtComplexityExceeds(GenTree** tree, unsigned limit);

bool gtCompareTree(GenTree* op1, GenTree* op2);

GenTree* gtReverseCond(GenTree* tree);

bool gtHasRef(GenTree* tree, ssize_t lclNum, bool defOnly);
Expand Down
77 changes: 0 additions & 77 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8631,83 +8631,6 @@ Compiler::fgWalkResult Compiler::fgUpdateSideEffectsPost(GenTree** pTree, fgWalk
return WALK_CONTINUE;
}

/*****************************************************************************
*
* Compares two trees and returns true when both trees are the same.
* Instead of fully comparing the two trees this method can just return false.
* Thus callers should not assume that the trees are different when false is returned.
* Only when true is returned can the caller perform code optimizations.
* The current implementation only compares a limited set of LEAF/CONST node
* and returns false for all othere trees.
*/
bool Compiler::gtCompareTree(GenTree* op1, GenTree* op2)
{
/* Make sure that both trees are of the same GT node kind */
if (op1->OperGet() != op2->OperGet())
{
return false;
}

/* Make sure that both trees are returning the same type */
if (op1->gtType != op2->gtType)
{
return false;
}

/* Figure out what kind of a node we have */

genTreeOps oper = op1->OperGet();
unsigned kind = op1->OperKind();

/* Is this a constant or leaf node? */

if (kind & (GTK_CONST | GTK_LEAF))
{
switch (oper)
{
case GT_CNS_INT:
if ((op1->AsIntCon()->gtIconVal == op2->AsIntCon()->gtIconVal) && GenTree::SameIconHandleFlag(op1, op2))
{
return true;
}
break;

case GT_CNS_LNG:
if (op1->AsLngCon()->gtLconVal == op2->AsLngCon()->gtLconVal)
{
return true;
}
break;

case GT_CNS_STR:
if (op1->AsStrCon()->gtSconCPX == op2->AsStrCon()->gtSconCPX)
{
return true;
}
break;

case GT_LCL_VAR:
if (op1->AsLclVarCommon()->GetLclNum() == op2->AsLclVarCommon()->GetLclNum())
{
return true;
}
break;

case GT_CLS_VAR:
if (op1->AsClsVar()->gtClsVarHnd == op2->AsClsVar()->gtClsVarHnd)
{
return true;
}
break;

default:
// we return false for these unhandled 'oper' kinds
break;
}
}
return false;
}

//------------------------------------------------------------------------
// gtGetThisArg: Return this pointer node for the call.
//
Expand Down