diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index b40187803..e7d6e9a40 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -847,7 +847,7 @@ private: virtual void visit(AstNodeVarRef* nodep) { if (nodep->varScopep() == m_elimVarScp) { // Substitute in the new tree - // It's possible we substitute into something that will be reduced more later + // It's possible we substitute into something that will be reduced more later, // however, as we never delete the top Always/initial statement, all should be well. m_didReplace = true; if (nodep->lvalue()) nodep->v3fatalSrc("Can't replace lvalue assignments with const var"); @@ -855,7 +855,7 @@ private: if (VN_IS(nodep, NodeVarRef) && VN_IS(substp, NodeVarRef) && nodep->same(substp)) { - // Prevent a infinite loop... + // Prevent an infinite loop... substp->v3fatalSrc("Replacing node with itself; perhaps circular logic?"); } // Which fileline() to use? @@ -907,10 +907,11 @@ class GateDedupeHash : public V3HashedUserCheck { private: // NODE STATE // Ast*::user2p -> parent AstNodeAssign* for this rhsp - // Ast*::user3p -> AstNode* checked in test for duplicate - // Ast*::user5p -> AstNode* checked in test for duplicate + // Ast*::user3p -> AstActive* of assign, for check() in test for duplicate + // Ast*::user5p -> AstNode* of assign if condition, for check() in test for duplicate // AstUser2InUse m_inuser2; (Allocated for use in GateVisitor) AstUser3InUse m_inuser3; + // AstUser4InUse m_inuser4; (Allocated for use in V3Hashed) AstUser5InUse m_inuser5; V3Hashed m_hashed; // Hash, contains rhs of assigns @@ -974,7 +975,7 @@ class GateDedupeVarVisitor : public GateBaseVisitor { // Any other ordering or node type, except for an AstComment, makes it not dedupable private: // STATE - GateDedupeHash m_hash; // Hash used to find dupes of rhs of assign + GateDedupeHash m_ghash; // Hash used to find dupes of rhs of assign AstNodeAssign* m_assignp; // Assign found for dedupe AstNode* m_ifCondp; // IF condition that assign is under bool m_always; // Assign is under an always @@ -1046,7 +1047,7 @@ public: if (lhsVarRefp->varScopep() != consumerVarScopep) { consumerVarScopep->v3fatalSrc("Consumer doesn't match lhs of assign"); } - if (AstNodeAssign* dup = m_hash.hashAndFindDupe(m_assignp, activep, m_ifCondp)) { + if (AstNodeAssign* dup = m_ghash.hashAndFindDupe(m_assignp, activep, m_ifCondp)) { return static_cast(dup->lhsp()); } } @@ -1077,7 +1078,7 @@ private: if (vvertexp->inSize1()) { AstNodeVarRef* dupVarRefp = static_cast (vvertexp->iterateInEdges(*this, VNUser(vvertexp)).toNodep()); - if (dupVarRefp) { + if (dupVarRefp) { // visit(GateLogicVertex*...) returned match V3GraphEdge* edgep = vvertexp->inBeginp(); GateLogicVertex* lvertexp = static_cast(edgep->fromp()); if (!vvertexp->dedupable()) vvertexp->varScp()->v3fatalSrc("GateLogicVertex* visit should have returned NULL if consumer var vertex is not dedupable."); @@ -1152,6 +1153,7 @@ void GateVisitor::dedupe() { AstNode::user2ClearTree(); GateDedupeGraphVisitor deduper; // Traverse starting from each of the clocks + UINFO(9,"Gate dedupe() clocks:\n"); for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) { if (GateVarVertex* vvertexp = dynamic_cast(itp)) { if (vvertexp->isClock()) { @@ -1160,6 +1162,7 @@ void GateVisitor::dedupe() { } } // Traverse starting from each of the outputs + UINFO(9,"Gate dedupe() outputs:\n"); for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) { if (GateVarVertex* vvertexp = dynamic_cast(itp)) { if (vvertexp->isTop() && vvertexp->varScp()->varp()->isWritable()) { diff --git a/src/V3Hashed.cpp b/src/V3Hashed.cpp index 759984d69..ae9d0d27f 100644 --- a/src/V3Hashed.cpp +++ b/src/V3Hashed.cpp @@ -161,7 +161,7 @@ void V3Hashed::dumpFile(const string& filename, bool tree) { V3Hash lasthash; int num_in_bucket = 0; for (HashMmap::iterator it=begin(); 1; ++it) { - if (lasthash != it->first || it==end()) { + if (it==end() || lasthash != it->first) { if (it!=end()) lasthash = it->first; if (num_in_bucket) { if (dist.find(num_in_bucket)==dist.end()) {