This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Drop the leading space when printing regions
ClosedPublic

Authored by Mogball on Jan 15 2022, 5:56 PM.

Details

Summary

The leading space that is always printed at the beginning of regions is not consistent with other parts of the printing API. Moreover, this leading space can lead to undesirable assembly formats:

attr-dict-with-keyword $region

Prints as:

// Two spaces between `}` and `{`
attributes {foo}  { ... }

Moreover, the leading space results in the odd generic op format:

"test.op"() ( {...}) : () -> ()

Diff Detail

Event Timeline

Mogball created this revision.Jan 15 2022, 5:56 PM
Mogball requested review of this revision.Jan 15 2022, 5:56 PM
rriddle accepted this revision.Jan 15 2022, 6:01 PM
This revision is now accepted and ready to land.Jan 15 2022, 6:01 PM
mehdi_amini accepted this revision.Jan 15 2022, 6:02 PM

LGTM, but please wait for River to double check that this does not induce new ambiguity.

Also the two examples you give in your description could be handled in the respective places (declarative ASM and generic printer) instead, but I agree that this API contract is more in-line with the other APIs here.

Mogball updated this revision to Diff 400742.Jan 17 2022, 11:51 PM

Fix flang

Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2022, 11:51 PM
This revision was landed with ongoing or failed builds.Jan 18 2022, 8:52 AM
This revision was automatically updated to reflect the committed changes.