diff --git a/mlir/lib/IR/BuiltinAttributes.cpp b/mlir/lib/IR/BuiltinAttributes.cpp --- a/mlir/lib/IR/BuiltinAttributes.cpp +++ b/mlir/lib/IR/BuiltinAttributes.cpp @@ -1466,7 +1466,12 @@ auto processElt = [&](decltype(*attr.begin()) value, size_t index) { auto newInt = mapping(value); assert(newInt.getBitWidth() == bitWidth); - writeBits(data.data(), index * storageBitWidth, newInt); + if (attr.isSplat() && bitWidth == 1) { + // Handle the special encoding of splat of bool. + data[0] = newInt.isZero() ? 0 : -1; + } else { + writeBits(data.data(), index * storageBitWidth, newInt); + } }; // Check for the splat case.