Internals: Replace unnecessary AstSel::widthp() child node with const in node (#6117)

This commit is contained in:
Geza Lore
2025-06-24 11:59:09 -04:00
committed by GitHub
parent a9e9ab50bd
commit 916d473eff
28 changed files with 276 additions and 354 deletions
+3 -5
View File
@@ -931,13 +931,11 @@ class CoverageVisitor final : public VNVisitor {
const int width = lhsp->dtypep()->width();
const size_t expected = std::is_same<T_Oper, AstXor>::value ? 0x1 << width : width + 1;
if (checkMaxExprs(expected)) return;
AstNodeExpr* unrolledp = new AstSel{fl, lhsp->cloneTree(false),
new AstConst{fl, static_cast<uint32_t>(width - 1)},
new AstConst{fl, 1}};
AstNodeExpr* unrolledp = new AstSel{
fl, lhsp->cloneTree(false), new AstConst{fl, static_cast<uint32_t>(width - 1)}, 1};
for (int bit = width - 2; bit >= 0; bit--) {
AstSel* const selp = new AstSel{fl, lhsp->cloneTree(false),
new AstConst{fl, static_cast<uint32_t>(bit)},
new AstConst{fl, 1}};
new AstConst{fl, static_cast<uint32_t>(bit)}, 1};
unrolledp = new T_Oper{fl, selp, unrolledp};
}
iterate(unrolledp);