write_smt2: Check for constant bool after fully resolving signal #3953
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3769.
The issue occured when exporting a bit that is driven through some connections by the output of a cell, but is known to be a constant. This happens with e.g. the following
where
b
is always0
, but is driven by the$reduce_or
cell.The previous code would export the
$reduce_or
just forinner[0]
. When exportingb
, thesigmap
would be unable to mapb
through to the constant value driving it, so would create a freshdeclare-fun
for it.With this change, when exporting
b
we first ensure that if there is a cell drivingb
it has been mapped and apply thesigmap
. This allows the subsequent code to see thatb
is constant, and thus emittrue
/false
directly, instead of doingdeclare-fun
.