OSDN Git Service

Update the maximum integer bitwidth in MLIR.
authorAndrew Lenharth <andrew@lenharth.org>
Tue, 5 Jan 2021 21:15:45 +0000 (15:15 -0600)
committerAndrew Lenharth <andrew@lenharth.org>
Fri, 8 Jan 2021 23:28:24 +0000 (17:28 -0600)
Large integers are generated in Circt commonly which exceed 4kbits.  This aligns the maximum bitwidth in MLIR and LLVM.

Reviewed By: rriddle, lattner, mehdi_amini

Differential Revision: https://reviews.llvm.org/D94116

mlir/include/mlir/IR/BuiltinTypes.h
mlir/test/IR/invalid-ops.mlir

index 3bfb3ce..d9d1a6e 100644 (file)
@@ -139,7 +139,7 @@ public:
   IntegerType scaleElementBitwidth(unsigned scale);
 
   /// Integer representation maximal bitwidth.
-  static constexpr unsigned kMaxWidth = 4096;
+  static constexpr unsigned kMaxWidth = (1 << 24) - 1; // Aligned with LLVM
 };
 
 //===----------------------------------------------------------------------===//
index 0b41f40..595e3fe 100644 (file)
@@ -135,8 +135,8 @@ func @test_alloc_memref_map_rank_mismatch() {
 
 func @intlimit2() {
 ^bb:
-  %0 = "std.constant"() {value = 0} : () -> i4096
-  %1 = "std.constant"() {value = 1} : () -> i4097 // expected-error {{integer bitwidth is limited to 4096 bits}}
+  %0 = "std.constant"() {value = 0} : () -> i16777215
+  %1 = "std.constant"() {value = 1} : () -> i16777216 // expected-error {{integer bitwidth is limited to 16777215 bits}}
   return
 }