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

Add utility that asserts that input IRModule is not mutated in a pass. #11498

Merged
merged 1 commit into from
May 30, 2022

Conversation

gigiblender
Copy link
Contributor

This PR adds a utility for testing purposes that asserts an IRModule used as input to a pass is not modified in place.

The testing.immutable_module option can be set to true in a PassContext to enable the assertion.

@masahi masahi merged commit 559f0c7 into apache:main May 30, 2022
@gigiblender gigiblender deleted the utility-ir-module branch May 30, 2022 07:48
Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

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

@gigiblender just wanted to point out one thing on this PR, otherwise I think it looks good.

pass_ctx.InstrumentAfterPass(ret, pass_info);
return std::move(ret);
}

IRModule Pass::AssertImmutableModule(const IRModule& mod, const PassNode* node,
Copy link
Contributor

Choose a reason for hiding this comment

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

suggest not taking const IRModule&--instead take IRModule. right now this is basically re-implemeting the copy constructor rather than just using it

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.

3 participants