[Mlir-commits] [mlir] [MLIR][NVVM] Fixed assertion failure for insufficient parsing validation of nvvm dialect PureSpecialRangeableRegisterOp (PR #163434)
Stefan Mada
llvmlistbot at llvm.org
Tue Oct 14 12:39:16 PDT 2025
================
@@ -279,6 +280,23 @@ class NVVM_PureSpecialRangeableRegisterOp<string mnemonic, list<Trait> traits =
SetIntRangeFn setResultRanges) {
nvvmInferResultRanges(getOperation(), getResult(), argRanges, setResultRanges);
}
+
+ // Verify the range attribute satisfies LLVM ConstantRange constructor requirements.
+ ::llvm::LogicalResult $cppClass::verify() {
----------------
smada3 wrote:
There are 34 registers that are part of this class, adding even a 1 line check for each of the specializations would add over 100 lines to NVVMDialect.cpp with code that is identical between them all. Is there a way to template the C++ code to avoid this? I agree with making a function for the verification logic that resides in C++, but I think doing this in tablegen would have the least amount of new code added. I think it would be easy to debug if we had something like:
```
::llvm::LogicalResult $cppClass::verify() {
return verifyConstantRangeAttr(getOperation(), getRange());
}
```
And then define `verifyConstantRangeAttr` in `NVVMDialect.cpp`. How does that seem?
https://github.com/llvm/llvm-project/pull/163434
More information about the Mlir-commits
mailing list