mirror of
https://github.com/verilator/verilator.git
synced 2026-09-02 10:48:27 +02:00
Fix exponential expansion in V3Gate (#7550)
Unfortunate constellation of combinational assignments could be inlined by V3Gate yielding an exponential expansion (added test used to consume 4GB+ memory and generate 3GB+ code).
This commit is contained in:
+7
-1
@@ -693,7 +693,9 @@ class GateInline final {
|
||||
for (V3GraphEdge& edge : vVtxp->outEdges()) {
|
||||
const GateLogicVertex* const dstVtxp = edge.top()->as<GateLogicVertex>();
|
||||
// Ignore slow code, or if the destination is not used
|
||||
if (!dstVtxp->slow() && !dstVtxp->outEmpty()) n += edge.weight();
|
||||
if (dstVtxp->slow()) continue;
|
||||
if (dstVtxp->outEmpty() && !dstVtxp->consumed()) continue;
|
||||
n += edge.weight();
|
||||
if (n > 1) break;
|
||||
}
|
||||
if (n > 1) continue;
|
||||
@@ -1308,6 +1310,10 @@ void V3Gate::gateAll(AstNetlist* netlistp) {
|
||||
graphp->removeRedundantEdgesSum(&V3GraphEdge::followAlwaysTrue);
|
||||
if (dumpGraphLevel() >= 6) graphp->dumpDotFilePrefixed("gate_simp");
|
||||
|
||||
// Remove unused logic
|
||||
GateUnused::apply(*graphp);
|
||||
if (dumpGraphLevel() >= 3) graphp->dumpDotFilePrefixed("gate_unused");
|
||||
|
||||
// Inline variables
|
||||
GateInline::apply(*graphp);
|
||||
if (dumpGraphLevel() >= 6) graphp->dumpDotFilePrefixed("gate_inline");
|
||||
|
||||
Reference in New Issue
Block a user