-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[Flang] Fix options for FunctionAttr pass #126819
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
[Flang] Fix options for FunctionAttr pass #126819
Conversation
For non-basic types GenericOptionParser::findArgStrForValue will return null when the specific values are not found. Add the enum, much like the debug-level option in AddDebugInfo to resolve this problem. Also change tuneCPU to be std::string or it will also have the same problem.
@llvm/pr-subscribers-flang-fir-hlfir Author: Scott Manley (rscottmanley) ChangesFor non-basic types GenericOptionParser::findArgStrForValue will return null, ultimately an llvm_unreachable, when the specific values are not found. Add the enum, much like the debug-level option in AddDebugInfo to resolve this problem. Also change tuneCPU to be std::string or it will also fail. Full diff: https://github.com/llvm/llvm-project/pull/126819.diff 1 Files Affected:
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.td b/flang/include/flang/Optimizer/Transforms/Passes.td
index 61f8b0835c958..0b6e0119c16c3 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.td
+++ b/flang/include/flang/Optimizer/Transforms/Passes.td
@@ -383,30 +383,33 @@ def FunctionAttr : Pass<"function-attr", "mlir::func::FuncOp"> {
freeing up an additional register in numerous functions. However, this
approach can make debugging unfeasible on certain machines.
}];
- let options = [
- Option<"framePointerKind", "frame-pointer",
- "mlir::LLVM::framePointerKind::FramePointerKind",
- /*default=*/"mlir::LLVM::framePointerKind::FramePointerKind{}",
- "frame pointer">,
- Option<"noInfsFPMath", "no-infs-fp-math",
- "bool", /*default=*/"false",
- "Set the no-infs-fp-math attribute on functions in the module.">,
- Option<"noNaNsFPMath", "no-nans-fp-math",
- "bool", /*default=*/"false",
- "Set the no-nans-fp-math attribute on functions in the module.">,
- Option<"approxFuncFPMath", "approx-func-fp-math",
- "bool", /*default=*/"false",
+ let options =
+ [Option<"framePointerKind", "frame-pointer",
+ "mlir::LLVM::framePointerKind::FramePointerKind",
+ /*default=*/"mlir::LLVM::framePointerKind::FramePointerKind{}",
+ "frame pointer", [{::llvm::cl::values(
+ clEnumValN(mlir::LLVM::framePointerKind::FramePointerKind::None, "None", ""),
+ clEnumValN(mlir::LLVM::framePointerKind::FramePointerKind::NonLeaf, "NonLeaf", ""),
+ clEnumValN(mlir::LLVM::framePointerKind::FramePointerKind::All, "All", ""),
+ clEnumValN(mlir::LLVM::framePointerKind::FramePointerKind::Reserved, "Reserved", "")
+ )}]>,
+ Option<"noInfsFPMath", "no-infs-fp-math", "bool", /*default=*/"false",
+ "Set the no-infs-fp-math attribute on functions in the module.">,
+ Option<"noNaNsFPMath", "no-nans-fp-math", "bool", /*default=*/"false",
+ "Set the no-nans-fp-math attribute on functions in the module.">,
+ Option<
+ "approxFuncFPMath", "approx-func-fp-math", "bool",
+ /*default=*/"false",
"Set the approx-func-fp-math attribute on functions in the module.">,
- Option<"noSignedZerosFPMath", "no-signed-zeros-fp-math",
- "bool", /*default=*/"false",
- "Set the no-signed-zeros-fp-math attribute on functions in the module.">,
- Option<"unsafeFPMath", "unsafe-fp-math",
- "bool", /*default=*/"false",
- "Set the unsafe-fp-math attribute on functions in the module.">,
- Option<"tuneCPU", "tune-cpu",
- "llvm::StringRef", /*default=*/"llvm::StringRef{}",
- "Set the tune-cpu attribute on functions in the module.">,
-];
+ Option<"noSignedZerosFPMath", "no-signed-zeros-fp-math", "bool",
+ /*default=*/"false",
+ "Set the no-signed-zeros-fp-math attribute on functions in the "
+ "module.">,
+ Option<"unsafeFPMath", "unsafe-fp-math", "bool", /*default=*/"false",
+ "Set the unsafe-fp-math attribute on functions in the module.">,
+ Option<"tuneCPU", "tune-cpu", "std::string", /*default=*/"",
+ "Set the tune-cpu attribute on functions in the module.">,
+ ];
}
def AssumedRankOpConversion : Pass<"fir-assumed-rank-op", "mlir::ModuleOp"> {
|
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.
LGTM. Thanks!
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.
Thanks!
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/89/builds/16448 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/19806 Here is the relevant piece of the build log for the reference
|
For non-basic types GenericOptionParser::findArgStrForValue will return null, ultimately an llvm_unreachable, when the specific values are not found. Add the enum, much like the debug-level option in AddDebugInfo to resolve this problem. Also change tuneCPU to be std::string or it will also fail.
For non-basic types GenericOptionParser::findArgStrForValue will return null, ultimately an llvm_unreachable, when the specific values are not found. Add the enum, much like the debug-level option in AddDebugInfo to resolve this problem. Also change tuneCPU to be std::string or it will also fail.
For non-basic types GenericOptionParser::findArgStrForValue will return null, ultimately an llvm_unreachable, when the specific values are not found. Add the enum, much like the debug-level option in AddDebugInfo to resolve this problem. Also change tuneCPU to be std::string or it will also fail.
For non-basic types GenericOptionParser::findArgStrForValue will return null, ultimately an llvm_unreachable, when the specific values are not found. Add the enum, much like the debug-level option in AddDebugInfo to resolve this problem. Also change tuneCPU to be std::string or it will also fail.