[PATCH] D75854: [mlir][ods] Fix AnyInteger predicate

Lei Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 9 09:41:16 PDT 2020


antiagainst created this revision.
antiagainst added reviewers: rriddle, mehdi_amini.
Herald added subscribers: llvm-commits, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, shauheen, burmako, jpienaar.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75854

Files:
  mlir/include/mlir/IR/OpBase.td
  mlir/test/lib/TestDialect/TestOps.td
  mlir/test/mlir-tblgen/types.mlir


Index: mlir/test/mlir-tblgen/types.mlir
===================================================================
--- mlir/test/mlir-tblgen/types.mlir
+++ mlir/test/mlir-tblgen/types.mlir
@@ -1,9 +1,9 @@
 // RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s
 
 func @correct_int_types_success() {
-  "test.int_types"() : () -> (i16, si32, ui64)
-  "test.int_types"() : () -> (si16, si32, ui64)
-  "test.int_types"() : () -> (ui16, si32, ui64)
+  "test.int_types"() : () -> (i16, si32, ui64, i8)
+  "test.int_types"() : () -> (si16, si32, ui64, ui64)
+  "test.int_types"() : () -> (ui16, si32, ui64, si128)
   return
 }
 
@@ -11,7 +11,7 @@
 
 func @wrong_int_type_signedness_failure() {
   // expected-error @+1 {{result #1 must be 32-bit signed integer, but got 'ui32'}}
-  "test.int_types"() : () -> (ui16, ui32, ui64)
+  "test.int_types"() : () -> (ui16, ui32, ui64, si8)
   return
 }
 
@@ -19,7 +19,7 @@
 
 func @wrong_int_type_signedness_failure() {
   // expected-error @+1 {{result #2 must be 64-bit unsigned integer, but got 'si64'}}
-  "test.int_types"() : () -> (ui16, si32, si64)
+  "test.int_types"() : () -> (ui16, si32, si64, ui8)
   return
 }
 
@@ -27,7 +27,15 @@
 
 func @wrong_int_type_failure() {
   // expected-error @+1 {{result #0 must be 16-bit integer, but got 'f16'}}
-  "test.int_types"() : () -> (f16, si32, ui64)
+  "test.int_types"() : () -> (f16, si32, ui64, i16)
+  return
+}
+
+// -----
+
+func @wrong_int_type_failure() {
+  // expected-error @+1 {{result #3 must be integer, but got 'f64'}}
+  "test.int_types"() : () -> (i16, si32, ui64, f64)
   return
 }
 
Index: mlir/test/lib/TestDialect/TestOps.td
===================================================================
--- mlir/test/lib/TestDialect/TestOps.td
+++ mlir/test/lib/TestDialect/TestOps.td
@@ -32,7 +32,8 @@
   let results = (outs
     AnyI16:$any_i16,
     SI32:$si32,
-    UI64:$ui64
+    UI64:$ui64,
+    AnyInteger:$any_int
   );
 }
 
Index: mlir/include/mlir/IR/OpBase.td
===================================================================
--- mlir/include/mlir/IR/OpBase.td
+++ mlir/include/mlir/IR/OpBase.td
@@ -315,7 +315,7 @@
 // Integer types.
 
 // Any integer type irrespective of its width and signedness semantics.
-def AnyInteger : Type<CPred<"$_self.isInteger()">, "integer">;
+def AnyInteger : Type<CPred<"$_self.isa<IntegerType>()">, "integer">;
 
 // Any integer type (regardless of signedness semantics) of a specific width.
 class AnyI<int width>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75854.249129.patch
Type: text/x-patch
Size: 2477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200309/dd9f7a3b/attachment.bin>


More information about the llvm-commits mailing list