Skip to content

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.
@trilorez trilorez requested a review from fabianschuiki June 22, 2023 21:25
@trilorez trilorez mentioned this pull request Jun 22, 2023
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