[mlir] Fix assert on signed integer type in EDSC
authorAdam Straw <adam.d.straw@intel.com>
Tue, 14 Apr 2020 19:49:18 +0000 (22:49 +0300)
committerDiego Caballero <diego.caballero@intel.com>
Tue, 14 Apr 2020 23:04:49 +0000 (02:04 +0300)
Integer type in Std dialect is signless so we should be checking
for signless integer type instead of signed integer type in EDSC.

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

mlir/lib/Dialect/Affine/EDSC/Builders.cpp

index 06f88dc..bc4dca2 100644 (file)
@@ -156,7 +156,7 @@ static ValueHandle createBinaryHandle(
     return createBinaryHandle<FOp>(lhs, rhs);
   } else if (thisType.isa<VectorType>() || thisType.isa<TensorType>()) {
     auto aggregateType = thisType.cast<ShapedType>();
-    if (aggregateType.getElementType().isSignedInteger())
+    if (aggregateType.getElementType().isSignlessInteger())
       return createBinaryHandle<IOp>(lhs, rhs);
     else if (aggregateType.getElementType().isa<FloatType>())
       return createBinaryHandle<FOp>(lhs, rhs);
@@ -225,7 +225,7 @@ static ValueHandle createIComparisonExpr(CmpIPredicate predicate,
   (void)lhsType;
   (void)rhsType;
   assert(lhsType == rhsType && "cannot mix types in operators");
-  assert((lhsType.isa<IndexType>() || lhsType.isSignedInteger()) &&
+  assert((lhsType.isa<IndexType>() || lhsType.isSignlessInteger()) &&
          "only integer comparisons are supported");
 
   auto op = ScopedContext::getBuilder().create<CmpIOp>(