[Mlir-commits] [mlir] a50c031 - [mlir][ods] Fix AnyInteger predicate

Lei Zhang llvmlistbot at llvm.org
Mon Mar 9 13:13:02 PDT 2020


Author: Lei Zhang
Date: 2020-03-09T20:12:15Z
New Revision: a50c031fab6747438af1454354ab85123558f6aa

URL: https://github.com/llvm/llvm-project/commit/a50c031fab6747438af1454354ab85123558f6aa
DIFF: https://github.com/llvm/llvm-project/commit/a50c031fab6747438af1454354ab85123558f6aa.diff

LOG: [mlir][ods] Fix AnyInteger predicate

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td
index d1491903eb7c..f32b8df7a9c3 100644
--- a/mlir/include/mlir/IR/OpBase.td
+++ b/mlir/include/mlir/IR/OpBase.td
@@ -315,7 +315,7 @@ class AnyTypeOf<list<Type> allowedTypes, string description = ""> : Type<
 // 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>

diff  --git a/mlir/test/lib/TestDialect/TestOps.td b/mlir/test/lib/TestDialect/TestOps.td
index 88c830740101..f472aa0b4cde 100644
--- a/mlir/test/lib/TestDialect/TestOps.td
+++ b/mlir/test/lib/TestDialect/TestOps.td
@@ -32,7 +32,8 @@ def IntTypesOp : TEST_Op<"int_types"> {
   let results = (outs
     AnyI16:$any_i16,
     SI32:$si32,
-    UI64:$ui64
+    UI64:$ui64,
+    AnyInteger:$any_int
   );
 }
 

diff  --git a/mlir/test/mlir-tblgen/types.mlir b/mlir/test/mlir-tblgen/types.mlir
index f498a74f596f..6850b77c7672 100644
--- a/mlir/test/mlir-tblgen/types.mlir
+++ b/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 @correct_int_types_success() {
 
 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() {
 
 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_signedness_failure() {
 
 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
 }
 


        


More information about the Mlir-commits mailing list