[Mlir-commits] [mlir] [MLIR] Add support for int8/uint8 properties (PR #145019)

Jacques Pienaar llvmlistbot at llvm.org
Mon Jun 23 06:53:24 PDT 2025


================
@@ -48,6 +48,40 @@ Attribute mlir::convertToAttribute(MLIRContext *ctx, int32_t storage) {
   return IntegerAttr::get(IntegerType::get(ctx, 32), storage);
 }
 
+LogicalResult
+mlir::convertFromAttribute(int8_t &storage, Attribute attr,
+                           function_ref<InFlightDiagnostic()> emitError) {
+  auto valueAttr = dyn_cast<IntegerAttr>(attr);
+  if (!valueAttr) {
+    emitError() << "expected IntegerAttr for key `value`";
----------------
jpienaar wrote:

Up to you, I like `return emitError` as its easier to see termination.

https://github.com/llvm/llvm-project/pull/145019


More information about the Mlir-commits mailing list