From 8e6fab307581088ab4731558414e1e243f4ba22f Mon Sep 17 00:00:00 2001 From: Yilou Wang Date: Tue, 14 Jul 2026 15:30:32 +0200 Subject: [PATCH] Delete orphaned gate expression when dist gating is skipped --- src/V3Randomize.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/V3Randomize.cpp b/src/V3Randomize.cpp index 41d963b60..a50292ddc 100644 --- a/src/V3Randomize.cpp +++ b/src/V3Randomize.cpp @@ -4624,7 +4624,10 @@ class RandomizeVisitor final : public VNVisitor { rmode.index); } }); - if (alwaysActive || !gatep) return chainp; + if (alwaysActive || !gatep) { + if (gatep) VL_DO_DANGLING(pushDeletep(gatep), gatep); + return chainp; + } AstNodeExpr* unionExprp = nullptr; for (auto& bucket : buckets) {