This is an archive of the discontinued LLVM Phabricator instance.

Refactor a MlirOptMainConfig class to hold the configuration of MlirOptMain (NFC)
ClosedPublic

Authored by mehdi_amini on Feb 11 2023, 2:12 PM.

Details

Summary

The list of boolean flags and others is becoming unresonnably long.

Diff Detail

Event Timeline

mehdi_amini created this revision.Feb 11 2023, 2:12 PM
mehdi_amini requested review of this revision.Feb 11 2023, 2:12 PM
jpienaar added inline comments.Feb 17 2023, 5:21 AM
mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
38

Should these have default true ? E..g.,

config.setSplitInputFile();

Reads naturally as enabling to me (and I believe we follow that style with printer).

118

Should we add the [[deprecated]] marker so that we get warnings?

146

Not quite sure i follow the ordering here (at least among the bools)

mehdi_amini added inline comments.Feb 17 2023, 5:18 PM
mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
38

Ah right, I set I shouldn't use set for the fluent style API but use enable or use depending on the flag: config.enableSplitInputFile()

118

We should, but can't hear, we have in-tree users. I actually plan to kill this soon (I'll put it on the new deprecations page on the website :)).

146

I think I took the order the cl::opt are defined in the source (it's a bad reason, it's just that I had split screen editor and went one by one!).

Should I put them in alphabetical order?

rriddle accepted this revision.Feb 22 2023, 9:09 AM
rriddle added inline comments.
mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
98

Drop the llvm:: here?

mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
329

I think the style prefers constructor calls IIRC.

This revision is now accepted and ready to land.Feb 22 2023, 9:09 AM

The windows build failures look real

rkayaith added inline comments.
mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
59–60

the docstrings on a few of these are wrong, seems the setVerifyPasses comment got copied

  • sort option implementation alphabetically
  • address other comments

C:\ws\w4\llvm-project\premerge-checks\mlir\include\mlir/Tools/mlir-opt/MlirOptMain.h(65): error C2039: 'function': is not a member of 'std'

(Will fix windows, it is still on my radar)

Fix windows build