Internals: Assert dtype comparison. No functional change intended.

This commit is contained in:
Wilson Snyder 2023-06-25 07:40:00 -04:00
parent c43e707f43
commit f9164ab0d2
1 changed files with 3 additions and 0 deletions

View File

@ -1083,6 +1083,9 @@ bool AstNode::sameTreeIter(const AstNode* node1p, const AstNode* node2p, bool ig
if (!node1p || !node2p) return false;
if (node1p->type() != node2p->type()) return false;
if (node1p->dtypep() != node2p->dtypep()) return false;
UASSERT_OBJ(
(!node1p->dtypep() && !node2p->dtypep()) || (node1p->dtypep() && node2p->dtypep()), node1p,
"Comparison of a node with dtypep() with a node without dtypep()\n-node2=" << node2p);
if (!node1p->same(node2p) || (gateOnly && !node1p->isGateOptimizable())) return false;
return (sameTreeIter(node1p->m_op1p, node2p->m_op1p, false, gateOnly)
&& sameTreeIter(node1p->m_op2p, node2p->m_op2p, false, gateOnly)