-
Notifications
You must be signed in to change notification settings - Fork 347
[PrefixModules] Rename references from the module body #5259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not much familiar with the pass, but the change looks good to me. Could you add a test?
50480c6
to
5642d77
Compare
5642d77
to
f746a6a
Compare
if (moduleName == oldName) { | ||
newTarget = module.getNameAttr(); | ||
} else { | ||
auto target = instanceGraph->lookup(moduleName)->getModule(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If InstanceGraph
caches the InstanceGraphNode::nodeMap
, this could be stale, with old (non-prefixed) name to module map. I am not sure, but just a thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assumption is that the module name is from a child module I guess. At least in my mind, a ref in a sv.verbatim
to a parent symbol is very dodgy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what behaviour should be if we reference a parent module, but even if we want to do something, I'd like to do it in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why you can't reference a parent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for fixing this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for fixing this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for fixing this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for fixing this!
I'm merging this in as it gets internal cores going. Let me know if it causes problems. |
I understand this is less broken, but please see this through. Here's a simple tweak to your test that demonstrates one of the kinds of breakages I mentioned: https://github.com/llvm/circt/compare/main...dtzSiFive:circt:misc/prefix-module-breakage?expand=1 . Running with this PR produces the following (should be caught by verifier (?!)):
Notice that in the presence of multiple prefixes being applied the inner ref is updated incorrectly (missing |
Required to unblock the build of internal cores with additional constraints.