This is an archive of the discontinued LLVM Phabricator instance.

[mlir:PassOption] Rework ListOption parsing and add support for std::vector/SmallVector options
ClosedPublic

Authored by rriddle on Apr 1 2022, 1:23 AM.

Details

Summary

ListOption currently uses llvm:🆑:list under the hood, but the usages
of ListOption are generally a tad different from llvm:🆑:list. This
commit codifies this by making ListOption implicitly comma separated,
and removes the explicit flag set for all of the current list options.
The new parsing for comma separation of ListOption also adds in support
for skipping over delimited sub-ranges (i.e. {}, [], (), "", ''). This
more easily supports nested options that use those as part of the
format, and this constraint (balanced delimiters) is already codified
in the syntax of pass pipelines.

See https://discourse.llvm.org/t/list-of-lists-pass-option/5950 for
related discussion

Diff Detail

Event Timeline

rriddle created this revision.Apr 1 2022, 1:23 AM
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
rriddle requested review of this revision.Apr 1 2022, 1:23 AM
gysit accepted this revision.Apr 1 2022, 1:47 AM

Very nice, thanks!

This revision is now accepted and ready to land.Apr 1 2022, 1:47 AM
gysit added inline comments.Apr 1 2022, 1:49 AM
mlir/include/mlir/Pass/PassOptions.h
29

nit: maybe passing _them_?

mehdi_amini accepted this revision.Apr 1 2022, 11:17 AM

I see not mention in the description, but isn't there a GitHub issue this is fixing?

mlir/include/mlir/Pass/PassOptions.h
77

I know we're not very code-size focused, but what about extracting the part of the function that aren't template dependent?
Maybe just making the findChar lambda a separate function would be enough?

198–201

May be worth updating the doc with the specificities of how it is parsed

rriddle updated this revision to Diff 419947.Apr 1 2022, 11:42 PM
rriddle edited the summary of this revision. (Show Details)
rriddle marked 3 inline comments as done.
rriddle added inline comments.Apr 1 2022, 11:43 PM
mlir/include/mlir/Pass/PassOptions.h
29

Thanks!

77

Thanks for pointing this out! Forgot to rework this after adding the template args.

I see not mention in the description, but isn't there a GitHub issue this is fixing?

There was a discourse post (which I added a link to), but I don't think we have an actual issue for this.