diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp --- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp +++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp @@ -1205,8 +1205,12 @@ return op.emitOpError() << "requires attribute's type (" << value.getType() << ") to match op's return type (" << type << ")"; - if (type.isa() || value.isa()) + if (type.isa()) { + if (!value.isa() && !value.isa()) + return op.emitOpError( + "requires 'value' to be a bool or integer constant"); return success(); + } if (auto intAttr = value.dyn_cast()) { IntegerType intType = type.cast();