Remove dead guards
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
This commit is contained in:
parent
feb11da024
commit
77e2c0b4e2
|
|
@ -3434,11 +3434,14 @@ class WidthVisitor final : public VNVisitor {
|
|||
}
|
||||
void visit(AstInsideRange* nodep) override {
|
||||
// Just do each side; AstInside will rip these nodes out later.
|
||||
// When visited in statement context (m_vup==nullptr), fold constants first so that
|
||||
// negative literals like -1 are collapsed before V3Width visits them as expressions.
|
||||
// When m_vup is null, this range appears outside a normal expression context (e.g.
|
||||
// in a covergroup bin declaration). Pre-fold constant arithmetic in that case
|
||||
// (e.g., AstNegate(Const) -> Const) so children have their types set before widthing.
|
||||
// We cannot do this unconditionally: in a normal 'inside' expression (m_vup set),
|
||||
// range bounds may be enum refs not yet widthed, and constifyEdit would crash.
|
||||
if (!m_vup) {
|
||||
if (nodep->lhsp()) V3Const::constifyEdit(nodep->lhsp());
|
||||
if (nodep->rhsp()) V3Const::constifyEdit(nodep->rhsp());
|
||||
V3Const::constifyEdit(nodep->lhsp()); // lhsp may change
|
||||
V3Const::constifyEdit(nodep->rhsp()); // rhsp may change
|
||||
}
|
||||
userIterateAndNext(nodep->lhsp(), m_vup);
|
||||
userIterateAndNext(nodep->rhsp(), m_vup);
|
||||
|
|
|
|||
Loading…
Reference in New Issue