Fix FSM detection of coverage-only branches (#7941) (#7942)

Fixes #7941
This commit is contained in:
Patrick Creighton
2026-07-16 09:48:36 -07:00
committed by GitHub
parent 255bcff3ac
commit cc1b36bafd
3 changed files with 70 additions and 2 deletions
+1 -2
View File
@@ -1106,9 +1106,8 @@ class FsmDetectVisitor final : public VNVisitor {
AstVarScope* thenVscp = nullptr;
AstVarScope* elseVscp = nullptr;
AstNode* const thenNodep = singleMeaningfulBranch(skipLeadingIgnorableStmt(ifp->thensp()));
UASSERT_OBJ(thenNodep, ifp, "Empty then-branch unexpectedly survived to FSM detection");
AstNode* const elseNodep = singleMeaningfulBranch(skipLeadingIgnorableStmt(ifp->elsesp()));
if (!elseNodep) return false;
if (!thenNodep || !elseNodep) return false;
if (!directConstStateAssignNode(thenNodep, thenVscp, thenValue)) return false;
if (!directConstStateAssignNode(elseNodep, elseVscp, elseValue)) return false;
if (thenVscp == stateVscp && elseVscp == stateVscp) return true;