Fix NBAs to unpacked arrays of unpacked structs (#5603)

This happened to work before #5516, by creating a whole shadow copy of
the entire array. Revert back to that behaviour for now, it will be
slow, but works still.

Fixes #5590
This commit is contained in:
Geza Lore
2024-11-10 17:38:28 +00:00
committed by GitHub
parent 03bd1bfc63
commit 863abdb1f7
3 changed files with 119 additions and 3 deletions
+8 -3
View File
@@ -251,10 +251,11 @@ class DelayedVisitor final : public VNVisitor {
const AstNodeDType* const dtypep = vscp->dtypep()->skipRefp();
// Unpacked arrays
if (const AstUnpackArrayDType* const uaDTypep = VN_CAST(dtypep, UnpackArrayDType)) {
// Basic underlying type of elements, if any.
AstBasicDType* const basicp = uaDTypep->basicp();
// If used in a loop, we must have a dynamic commit queue. (Also works in suspendables)
if (vscpInfo.m_inLoop) {
// Arrays with compound element types are currently not supported in loops
AstBasicDType* const basicp = uaDTypep->basicp();
if (!basicp
|| !(basicp->isIntegralOrPacked() //
|| basicp->isDouble() //
@@ -266,8 +267,12 @@ class DelayedVisitor final : public VNVisitor {
}
// In a suspendable of fork, we must use the unique flag scheme, TODO: why?
if (vscpInfo.m_inSuspOrFork) return Scheme::FlagUnique;
// Otherwise use the shared flag scheme
return Scheme::FlagShared;
// Otherwise if an array of packed/basic elements, use the shared flag scheme
if (basicp) return Scheme::FlagShared;
// Finally fall back on the shadow variable scheme, e.g. for
// arrays of unpacked structs. This will be slow.
// TODO: generic LHS scheme as discussed in #5092
return Scheme::ShadowVar;
}
// In a suspendable of fork, we must use the unique flag scheme, TODO: why?