Preserve stream cast context through casts

This commit is contained in:
JAEUK LEE 2026-07-08 19:37:00 +09:00
parent 7655ccf400
commit cb6634366c
1 changed files with 4 additions and 4 deletions

View File

@ -2755,7 +2755,7 @@ class WidthVisitor final : public VNVisitor {
VL_DO_DANGLING(fromp->deleteTree(), fromp);
}
}
userIterateAndNext(nodep->fromp(), WidthVP{SELF, PRELIM}.p());
userIterateAndNext(nodep->fromp(), WidthVP{SELF, PRELIM, STREAM_USE_CAST}.p());
UINFOTREE(9, nodep, "", "CastDit");
AstNodeDType* const toDtp = nodep->dtypep()->skipRefToEnump();
AstNodeDType* const fromDtp = nodep->fromp()->dtypep()->skipRefToEnump();
@ -2881,7 +2881,7 @@ class WidthVisitor final : public VNVisitor {
nodep->v3error("Size-changing cast to zero or negative size: " << width);
width = 1;
}
userIterateAndNext(nodep->lhsp(), WidthVP{SELF, PRELIM}.p());
userIterateAndNext(nodep->lhsp(), WidthVP{SELF, PRELIM, STREAM_USE_CAST}.p());
castSized(nodep, nodep->lhsp(), width); // lhsp may change
}
if (m_vup->final()) {
@ -2894,7 +2894,7 @@ class WidthVisitor final : public VNVisitor {
}
void visit(AstCastWrap* nodep) override {
// Inserted by V3Width only so we know has been resolved
userIterateAndNext(nodep->lhsp(), WidthVP{nodep->dtypep(), BOTH}.p());
userIterateAndNext(nodep->lhsp(), WidthVP{nodep->dtypep(), BOTH, STREAM_USE_CAST}.p());
}
void castSized(AstNode* nodep, AstNode* underp, int width) {
const AstBasicDType* underDtp = VN_CAST(underp->dtypep(), BasicDType);
@ -2915,7 +2915,7 @@ class WidthVisitor final : public VNVisitor {
nodep->dtypep(calcDtp);
// We ignore warnings as that is sort of the point of a cast
iterateCheck(nodep, "Cast expr", underp, CONTEXT_DET, FINAL, calcDtp, EXTEND_EXP,
false);
false, STREAM_USE_CAST);
VL_DANGLING(underp);
underp = nodep->op1p(); // Above asserts that op1 was underp pre-relink
}