From bca2e2c16e4fbd9a532cf8be10e00ee3bce63426 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Sun, 15 Jun 2025 16:00:11 +0100 Subject: [PATCH] Optimize DFG De Morgan patterns (#6090) It's ok if the replaced vertex has multiple sinks, this pattern cannot increase the size of logic even then. --- src/V3DfgPeephole.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/V3DfgPeephole.cpp b/src/V3DfgPeephole.cpp index ff3b42020..cd1915f06 100644 --- a/src/V3DfgPeephole.cpp +++ b/src/V3DfgPeephole.cpp @@ -895,8 +895,8 @@ class V3DfgPeephole final : public DfgVisitor { DfgVertex* const rhsp = vtxp->rhsp(); FileLine* const flp = vtxp->fileline(); - // Bubble pushing - if (!vtxp->hasMultipleSinks() && !lhsp->hasMultipleSinks() && !rhsp->hasMultipleSinks()) { + // Bubble pushing (De Morgan) + if (!lhsp->hasMultipleSinks() && !rhsp->hasMultipleSinks()) { if (DfgNot* const lhsNotp = lhsp->cast()) { if (DfgNot* const rhsNotp = rhsp->cast()) { APPLYING(REPLACE_AND_OF_NOT_AND_NOT) { @@ -964,8 +964,8 @@ class V3DfgPeephole final : public DfgVisitor { DfgVertex* const rhsp = vtxp->rhsp(); FileLine* const flp = vtxp->fileline(); - // Bubble pushing - if (!vtxp->hasMultipleSinks() && !lhsp->hasMultipleSinks() && !rhsp->hasMultipleSinks()) { + // Bubble pushing (De Morgan) + if (!lhsp->hasMultipleSinks() && !rhsp->hasMultipleSinks()) { if (DfgNot* const lhsNotp = lhsp->cast()) { if (DfgNot* const rhsNotp = rhsp->cast()) { APPLYING(REPLACE_OR_OF_NOT_AND_NOT) {