This is an archive of the discontinued LLVM Phabricator instance.

[mlir][IR] Clean up mergeBlockBefore and mergeBlocks
ClosedPublic

Authored by springerm on Feb 28 2023, 7:37 AM.

Details

Summary
  • RewriterBase::mergeBlocks is simplified: it is implemented in terms of mergeBlockBefore.
  • The signature of mergeBlockBefore is consistent with other API (such as inlineRegionBefore): an overload for a Block::iterator is added.
  • Additional safety checks are added to mergeBlockBefore: detect cases where the resulting IR could be invalid (no more dropAllUses) or partly unreachable (likely a case of incorrect API usage).

Depends On: D144549

Diff Detail

Event Timeline

springerm created this revision.Feb 28 2023, 7:37 AM
springerm requested review of this revision.Feb 28 2023, 7:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 28 2023, 7:37 AM

Note: mergeBlockBefore could be renamed to inlineBlockBefore to be consistent with the inlineRegionBefore name, but not sure if it's worth the churn.

rriddle accepted this revision.Mar 3 2023, 9:48 AM

Feel free to rename the API, I don't think the API churn in this case would be that bad.

This revision is now accepted and ready to land.Mar 3 2023, 9:48 AM
springerm updated this revision to Diff 502574.Mar 6 2023, 3:49 AM
springerm edited the summary of this revision. (Show Details)

update

This revision was landed with ongoing or failed builds.Mar 6 2023, 4:53 AM
This revision was automatically updated to reflect the committed changes.