diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp --- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp +++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp @@ -878,7 +878,7 @@ // Otherwise, build a complex name with the value and type. SmallString<32> specialNameBuffer; llvm::raw_svector_ostream specialName(specialNameBuffer); - specialName << 'c' << intCst.getInt(); + specialName << 'c' << intCst.getValue(); if (intTy) specialName << '_' << type; setNameFn(getResult(), specialName.str()); @@ -917,7 +917,7 @@ /// ConstantIntOp only matches values whose result type is an IntegerType. bool ConstantIntOp::classof(Operation *op) { return ConstantOp::classof(op) && - op->getResult(0).getType().isSignlessInteger(); + (op->getResult(0).getType().isa()); } void ConstantIntOp::build(Builder *builder, OperationState &result, diff --git a/mlir/test/IR/parser.mlir b/mlir/test/IR/parser.mlir --- a/mlir/test/IR/parser.mlir +++ b/mlir/test/IR/parser.mlir @@ -492,12 +492,17 @@ // Test pretty printing of constant names. // CHECK-LABEL: func @constants -func @constants() -> (i32, i23, i23, i1, i1) { +func @constants() -> (i32, i23, ui32, ui23, i23, i1, i1) { // CHECK: %{{.*}} = constant 42 : i32 %x = constant 42 : i32 // CHECK: %{{.*}} = constant 17 : i23 %y = constant 17 : i23 + // CHECK: %{{.*}} = constant 42 : ui32 + %ux = constant 42 : ui32 + // CHECK: %{{.*}} = constant 17 : ui23 + %uy = constant 17 : ui23 + // This is a redundant definition of 17, the asmprinter gives it a unique name // CHECK: %{{.*}} = constant 17 : i23 %z = constant 17 : i23 @@ -513,7 +518,7 @@ %h = constant 0xf32 : i32 // CHECK: return %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} - return %x, %y, %z, %t, %f : i32, i23, i23, i1, i1 + return %x, %y, %ux, %uy, %z, %t, %f : i32, i23, ui32, ui23, i23, i1, i1 } // CHECK-LABEL: func @typeattr