diff --git a/src/V3Dfg.h b/src/V3Dfg.h index c66d2d1a6..11c2f0da8 100644 --- a/src/V3Dfg.h +++ b/src/V3Dfg.h @@ -829,6 +829,13 @@ bool DfgVertex::isCheaperThanLoad() const { const uint32_t msb = lsb + selp->width() - 1; return VL_BITWORD_E(msb) == VL_BITWORD_E(lsb); } + // Replication of a single cheap bit. Each word of the result is the same + // mask computed by negating that bit, so recomputing it at each use costs + // no more than the load it replaces. + if (const DfgRep* const repp = cast()) { + const DfgVertex* const srcp = repp->srcp(); + return srcp->width() == 1 && srcp->isCheaperThanLoad(); + } // Zero extend of a cheap vertex - Extend(_) was converted to Concat(0, _) if (const DfgConcat* const catp = cast()) { if (catp->width() > VL_QUADSIZE) return false;