llvm::APInt cannot hold zero bit values, therefore we shouldn't try
to form them.
Differential Revision: https://reviews.llvm.org/D94384
// Extend or truncate the bitwidth to the right size.
unsigned width = type.isIndex() ? IndexType::kInternalStorageBitWidth
: type.getIntOrFloatBitWidth();
+
+ // APInt cannot hold a zero bit value.
+ if (width == 0)
+ return llvm::None;
+
if (width > result.getBitWidth()) {
result = result.zext(width);
} else if (width < result.getBitWidth()) {
return
}
+
+// -----
+
+func @no_zero_bit_integer_attrs() {
+ // expected-error @+1 {{integer constant out of range for attribute}}
+ %x = "some.op"(){value = 0 : i0} : () -> f32
+ return
+}
\ No newline at end of file