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
This commit is contained in:
Mehdi Amini
2023-05-24 13:30:49 -07:00
parent 63a2b206fa
commit 5f649130eb
2 changed files with 5 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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 } { }