-
Notifications
You must be signed in to change notification settings - Fork 298
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
[SV] Mark sv.xmr.ref op as pure #6260
Conversation
Having an `sv.xmr.ref` ops inside a procedural block such as `sv.alwayscomb` triggers an assertion in `PrepareForEmission`. The pass would identify the ref op as having side-effects and then go ahead and try to pull it outside the procedural block. Doing so would create a `sv.reg` op with multiple nested inout types, which breaks. Fix the issue by marking the `sv.xmr.ref` op as pure. Taking a reference to something does not have a side-effect. It's accessing what's behind the reference that has side-effects.
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
def XMRRefOp : SVOp<"xmr.ref", [ | ||
DeclareOpInterfaceMethods<SymbolUserOpInterface>, | ||
Pure | ||
]> { |
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.
Nice indentation of traits!
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 think this makes sense, thanks!
Having an
sv.xmr.ref
op inside a procedural block such assv.alwayscomb
triggers an assertion inPrepareForEmission
. The pass would identify the ref op as having side-effects and then go ahead and try to pull it outside the procedural block. Doing so would create asv.reg
op with multiple nested inout types, which breaks.Fix the issue by marking the
sv.xmr.ref
op as pure. Taking a reference to something does not have a side-effect. It's accessing what's behind the reference that has side-effects.