[TableGen] TreePatternNode::isIsomorphicTo - early out for matching leafs. NFCI.

If the leafs are the same then no need to perform DefInit matching.
This commit is contained in:
Simon Pilgrim 2021-05-15 15:34:43 +01:00
parent 73635adb86
commit 632668c1c0
1 changed files with 3 additions and 1 deletions

View File

@ -1946,6 +1946,8 @@ bool TreePatternNode::isIsomorphicTo(const TreePatternNode *N,
return false;
if (isLeaf()) {
if (getLeafValue() == N->getLeafValue())
return true;
if (DefInit *DI = dyn_cast<DefInit>(getLeafValue())) {
if (DefInit *NDI = dyn_cast<DefInit>(N->getLeafValue())) {
return ((DI->getDef() == NDI->getDef())
@ -1953,7 +1955,7 @@ bool TreePatternNode::isIsomorphicTo(const TreePatternNode *N,
|| getName() == N->getName()));
}
}
return getLeafValue() == N->getLeafValue();
return false;
}
if (N->getOperator() != getOperator() ||