This is an archive of the discontinued LLVM Phabricator instance.

[mlir][IR] Improve listener notifications for ops without results
ClosedPublic

Authored by springerm on Jun 13 2023, 6:40 AM.

Details

Summary

RewriterBase::Listener::notifyOperationReplaced notifies observers that an op is about to be replaced with a range of values. This notification is not very useful for ops without results, because it does not specify the replacement op (and it cannot be deduced from the replacement values). It provides no additional information over the notifyOperationRemoved notification.

This revision adds an additional notification when a rewriter replaces an op with another op. By default, this notification triggers the original "op replaced with values" notification, so there is no functional change for existing code.

This new API is useful for the transform dialect, which needs to track op replacements. (Updated in a subsequent revision.)

Also includes minor documentation improvements.

Diff Detail

Event Timeline

springerm created this revision.Jun 13 2023, 6:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2023, 6:40 AM
springerm requested review of this revision.Jun 13 2023, 6:40 AM
rriddle accepted this revision.Jun 13 2023, 7:21 PM
This revision is now accepted and ready to land.Jun 13 2023, 7:21 PM