This is an archive of the discontinued LLVM Phabricator instance.

[mlir][SCF][NFC] Add helper functions to get body of scf.while
ClosedPublic

Authored by springerm on Aug 14 2023, 5:45 AM.

Details

Summary

Add two new helper functions getBeforeBody and getAfterBody to be consistent with "scf.for" (getBody) and to show in the API that both regions have exactly one block. Also simplify some code that assumed that there can be more than one block in a region.

Diff Detail

Event Timeline

springerm created this revision.Aug 14 2023, 5:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2023, 5:45 AM
springerm requested review of this revision.Aug 14 2023, 5:45 AM
guraypp accepted this revision.Aug 14 2023, 5:54 AM

Nice, it simplifies some codes.

mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
578

why do we loose notifyMatchFailure here?

mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
762–763

again, why do we loose asserts?

This revision is now accepted and ready to land.Aug 14 2023, 5:54 AM
springerm marked 2 inline comments as done.Aug 14 2023, 5:56 AM
springerm added inline comments.
mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
578

scf.while always has one block in the "after" region.

mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
762–763

both regions always have exactly one block

This revision was landed with ongoing or failed builds.Aug 14 2023, 6:03 AM
This revision was automatically updated to reflect the committed changes.
springerm marked 2 inline comments as done.