[Mlir-commits] [mlir] 5f64913 - Fix MLIR bytecode reading of i0 IntegerAttr
Mehdi Amini
llvmlistbot at llvm.org
Wed May 24 13:46:13 PDT 2023
Author: Mehdi Amini
Date: 2023-05-24T13:45:58-07:00
New Revision: 5f649130eb5ff048bfbda84f5847da0072c2500f
URL: https://github.com/llvm/llvm-project/commit/5f649130eb5ff048bfbda84f5847da0072c2500f
DIFF: https://github.com/llvm/llvm-project/commit/5f649130eb5ff048bfbda84f5847da0072c2500f.diff
LOG: Fix MLIR bytecode reading of i0 IntegerAttr
The move of the bytecode serialization to be tablegen driven in
https://reviews.llvm.org/D144820 added a new condition in the reading
path that forbid 0-sized integer, even though we still produce them.
Fix #62920
Differential Revision: https://reviews.llvm.org/D151372
Added:
mlir/test/Bytecode/empty_attr.mlir
Modified:
mlir/lib/IR/BuiltinDialectBytecode.cpp
Removed:
################################################################################
diff --git a/mlir/lib/IR/BuiltinDialectBytecode.cpp b/mlir/lib/IR/BuiltinDialectBytecode.cpp
index 75457e9ff85fb..b7a27842e2681 100644
--- a/mlir/lib/IR/BuiltinDialectBytecode.cpp
+++ b/mlir/lib/IR/BuiltinDialectBytecode.cpp
@@ -43,8 +43,6 @@ static unsigned getIntegerBitWidth(DialectBytecodeReader &reader, Type type) {
static LogicalResult readAPIntWithKnownWidth(DialectBytecodeReader &reader,
Type type, FailureOr<APInt> &val) {
unsigned bitWidth = getIntegerBitWidth(reader, type);
- if (bitWidth == 0)
- return failure();
val = reader.readAPIntWithKnownWidth(bitWidth);
return val;
}
diff --git a/mlir/test/Bytecode/empty_attr.mlir b/mlir/test/Bytecode/empty_attr.mlir
new file mode 100644
index 0000000000000..1a33cbd374066
--- /dev/null
+++ b/mlir/test/Bytecode/empty_attr.mlir
@@ -0,0 +1,5 @@
+// RUN: mlir-opt -emit-bytecode %s | mlir-opt | FileCheck %s
+
+// CHECK: module
+// CHECK: foo.asdf = 0 : i0
+module attributes { foo.asdf = 0 : i0 } { }
More information about the Mlir-commits
mailing list