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

[Seq] Fix FirMemReadWriteOp::canonicalize #5460

Merged
merged 1 commit into from
Jun 23, 2023

Conversation

trilorez
Copy link
Contributor

The canonicalizer no longer accesses the op after it has been erased.

The canonicalizer no longer accesses the op after it has been erased.
Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

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

Nice.

An alternative would be to do a 4-step process of:

  1. Create the new FirMemReadOp (not replaceOpWithNewOp).
  2. Copy over the attributes.
  3. RAUW
  4. Erase the old op.

The cost of the temporary is basically free here as these temporaries are ArrayRef<NamedAttribute> and ArrayRef<StringRef>. I think that this is safe as everything backing those refs should be in interned storage. However, I'm not totally sure.

@trilorez trilorez merged commit aa1219e into main Jun 23, 2023
@trilorez trilorez deleted the dev/trilorez/fix-fir-mem-canon branch June 23, 2023 02:55
@fabianschuiki
Copy link
Contributor

Awesome! Thanks a lot for the quick fix 💯. Totally missed that during testing 🤔

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