From 599e788f249e478b5817b6cf45584d8e43458df4 Mon Sep 17 00:00:00 2001 From: Mathias Preiner Date: Wed, 4 Sep 2019 11:13:18 -0700 Subject: [PATCH] Fix DAGification for printer. (#3233) --- src/printer/dagification_visitor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/printer/dagification_visitor.cpp b/src/printer/dagification_visitor.cpp index a024c97a7..67c5aa7e5 100644 --- a/src/printer/dagification_visitor.cpp +++ b/src/printer/dagification_visitor.cpp @@ -106,7 +106,12 @@ void DagificationVisitor::visit(TNode current, TNode parent) { TNode& uniqueParent = d_uniqueParent[current]; - if(!uniqueParent.isNull() && uniqueParent != parent) { + // We restrict this optimization to nodes with arity 1 since otherwise we + // may run into issues with tree traverals. Without this restriction + // dumping regress3/pp-regfile increases the file size by a factor of 5000. + if (!uniqueParent.isNull() + && (uniqueParent != parent || parent.getNumChildren() > 1)) + { // there is not a unique parent for this expr, mark it uniqueParent = TNode::null(); } -- 2.30.2