[Mlir-commits] [mlir] [MLIR][NVVM] Fix crash on invalid optimization level in NVVMTargetAttr (PR #173280)
Srinivasa Ravi
llvmlistbot at llvm.org
Sun Jan 4 22:43:27 PST 2026
================
@@ -5559,6 +5555,11 @@ NVVMTargetAttr::verify(function_ref<InFlightDiagnostic()> emitError,
}
LogicalResult NVVMTargetAttr::verifyTarget(Operation *gpuModule) {
+ if (getO() < 0 || getO() > 3) {
+ return emitError(
+ gpuModule->getLoc(),
+ "The optimization level must be a number between 0 and 3.");
+ }
----------------
Wolfram70 wrote:
`NVVMTargetAttr::verifyTarget` is only to verify the module with respect to the target chip architecture so I don't think we want to verify any other parameters here.
Looks like the issue could be in the builders for `NVVMTargetAttr` (https://github.com/llvm/llvm-project/issues/130014#issuecomment-3709132804) so resolving that might fix the crash and allow us to gracefully error out instead.
https://github.com/llvm/llvm-project/pull/173280
More information about the Mlir-commits
mailing list