-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir] Fixing a regression that '-D' option of llvm-tblgen is unregistered. #91329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,16 @@ int main(int argc, char **argv) { | |
"write-if-changed", | ||
llvm::cl::desc("Only write to the output file if it changed")); | ||
|
||
// `ResetCommandLineParser` at the above unregistered the "D" option | ||
// of `llvm-tblgen`, which caused `TestOps.cpp` to fail due to | ||
// "Unknnown command line argument '-D...`" when a macros name is | ||
// present. The following is a workaround to re-register it again. | ||
llvm::cl::list<std::string> MacroNames( | ||
"D", | ||
llvm::cl::desc( | ||
"Name of the macro to be defined -- ignored by mlir-src-sharder"), | ||
llvm::cl::value_desc("macro name"), llvm::cl::Prefix); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be documented as ignored and present for compatibility I think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review. Which document are you thinking of? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. Thanks. BTW, when I run
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely something expected! @Mogball do you know about this? |
||
|
||
llvm::InitLLVM y(argc, argv); | ||
llvm::cl::ParseCommandLineOptions(argc, argv); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason the variable name starts with uppercase while he others above start with lowercase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. This code is coming from
llvm/lib/TableGen/Main.cpp
wherellvm-tblgen
sets itscl
options. It seems LLVM always use uppercase forcl
option variables, but MLIR uses lowercase. I am not sure if we should keep it consistent with LLVM or keep using lowercase in MLIR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable should follow MLIR convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I will post another patch to change to lowercase
macroNames
.