[Mlir-commits] [mlir] [MLIR][NVVM] Update Op verifiers to prevent ungraceful exits (PR #165677)
Durgadoss R
llvmlistbot at llvm.org
Mon Nov 3 04:39:36 PST 2025
================
@@ -867,15 +867,34 @@ LogicalResult MmaOp::verify() {
}
LogicalResult ShflOp::verify() {
- if (!(*this)->getAttrOfType<UnitAttr>("return_value_and_is_valid"))
- return success();
- auto type = llvm::dyn_cast<LLVM::LLVMStructType>(getType());
- auto elementType = (type && type.getBody().size() == 2)
- ? llvm::dyn_cast<IntegerType>(type.getBody()[1])
- : nullptr;
- if (!elementType || elementType.getWidth() != 1)
- return emitError("expected return type to be a two-element struct with "
- "i1 as the second element");
+ auto returnStructType = llvm::dyn_cast<LLVM::LLVMStructType>(getType());
+
+ if (returnStructType && !getReturnValueAndIsValid())
----------------
durga4github wrote:
I think we can include all the below checks within this `if`:
```
if (returnStructType) {
if (attr not given) -> emitError()
if (num-elems != 2) -> emitError()
if (elem[1] != i1) -> emitError()
if (inp-out-type-mismatch) -> emitError()
..
..
} else {
if (inp-out-type-mismatch) -> emitError()
}
```
Then, move the type checking of `val` and `res` into a lambda above these.
I think that can simplify things..
https://github.com/llvm/llvm-project/pull/165677
More information about the Mlir-commits
mailing list