Skip to content
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

[FIRRTL] Clean up RWProbe's verifier #5806

Merged
merged 1 commit into from
Aug 8, 2023
Merged

[FIRRTL] Clean up RWProbe's verifier #5806

merged 1 commit into from
Aug 8, 2023

Conversation

youngar
Copy link
Member

@youngar youngar commented Aug 8, 2023

Two changes:

  1. The ODS generated verifier checks that the operation has a valid targetRef attribute, so there is no need to check it ourselves in the verifier. This is currently an untestable code-path.
  2. When the target is invalid, it prints as <invalid target>. It makes more sense to print the original InnerRefAttr for this case. This change adds a test case for this.

Copy link
Contributor

@dtzSiFive dtzSiFive left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Testing error paths is good, would've revealed this. Thanks for fixing + testing!

if (targetRef.getModule() !=
(*this)->getParentOfType<FModuleLike>().getModuleNameAttr())
return emitOpError() << "has non-local target";

auto target = ns.lookup(targetRef);
if (!target)
return emitOpError() << "has target that cannot be resolved: " << target;
return emitOpError() << "has target that cannot be resolved: " << targetRef;
Copy link
Contributor

Choose a reason for hiding this comment

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

Oof, thanks!

@youngar youngar added the FIRRTL Involving the `firrtl` dialect label Aug 8, 2023
@dtzSiFive dtzSiFive mentioned this pull request Aug 8, 2023
Comment on lines -5129 to -5130
if (!targetRef)
return emitOpError("has invalid target reference");
Copy link
Member

Choose a reason for hiding this comment

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

Great! Thanks for catching this.

Two changes:

1) The ODS generated verifier checks that the operation has a valid `targetRef`
attribute, so there is no need to check it ourselves in the verifier.  This is
currently an untestable code-path.
2) When the target is invalid, it prints as `<invalid target>`.  It makes more
sense to print the original InnerRefAttr for this case. This change adds a test
case for this.
@youngar youngar merged commit 419aa33 into main Aug 8, 2023
5 checks passed
@youngar youngar deleted the rwprobe-verifier branch August 8, 2023 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FIRRTL Involving the `firrtl` dialect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants