Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@uenoku
Copy link
Member

@uenoku uenoku commented Dec 4, 2024

This PR changes to clone discardable attributes when operation is cloned.

Fix #7934. AttributeAnnotation adds sv.attributes in LowerAnnotation as a discardable attribute which previously LowerTypes dropped.

Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment on lines -1505 to +1508
// Copy over any attributes which have not already been copied over by
// arguments to the builder.
auto attrNames = InstanceOp::getAttributeNames();
DenseSet<StringRef> attrSet(attrNames.begin(), attrNames.end());
SmallVector<NamedAttribute> newAttrs(newInstance->getAttrs());
for (auto i : llvm::make_filter_range(op->getAttrs(), [&](auto namedAttr) {
return !attrSet.count(namedAttr.getName());
}))
newAttrs.push_back(i);
newInstance->setAttrs(newAttrs);
newInstance->setDiscardableAttrs(op->getDiscardableAttrDictionary());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice cleanup as it should avoid re-interning.

@uenoku uenoku merged commit d912e07 into main Dec 5, 2024
4 checks passed
@uenoku uenoku deleted the dev/hidetou/lower-type-discardable branch December 5, 2024 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[firtool] firrtl.AttributeAnnotation on arrays is ignored by firtool

3 participants