Fix splitting of assignments to SC variables (#6329) (#6336)

SC variables can only be assigned whole, so do not split up
concatenation assignments in V3FuncOpt.

Fixes #6329
This commit is contained in:
Geza Lore
2025-08-28 08:48:51 +01:00
committed by GitHub
parent 409e036eca
commit 1043a6c6be
3 changed files with 27 additions and 1 deletions
+2
View File
@@ -228,6 +228,8 @@ class FuncOptVisitor final : public VNVisitor {
UASSERT_OBJ(lhsp->width() == rhsp->width(), nodep, "Inconsistent assignment");
// Only consider pure assignments. Nodes inserted below are safe.
if (!nodep->user1() && (!lhsp->isPure() || !rhsp->isPure())) return false;
// Do not split assignments to SC variables, they cannot be assigned in parts
if (lhsp->exists([](AstVarRef* refp) { return refp->varp()->isSc(); })) return false;
// Check for a Sel on the LHS if present, and skip over it
uint32_t lsb = 0;
if (AstSel* const selp = VN_CAST(lhsp, Sel)) {