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,14 @@ // 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'; + if (intTy && intTy.isSigned()) + specialName << intCst.getSInt(); + else if (intTy && intTy.isUnsigned()) + specialName << intCst.getUInt(); + else + specialName << intCst.getInt(); + if (intTy) specialName << '_' << type; setNameFn(getResult(), specialName.str()); diff --git a/mlir/test/IR/core-ops.mlir b/mlir/test/IR/core-ops.mlir --- a/mlir/test/IR/core-ops.mlir +++ b/mlir/test/IR/core-ops.mlir @@ -98,6 +98,12 @@ // CHECK: %cst = constant 4.300000e+01 : bf16 %9 = constant 43.0 : bf16 + // CHECK: %c42_si32 = constant 42 : si32 + %c42_si32 = constant 42 : si32 + + // CHECK: %c42_ui32 = constant 42 : ui32 + %c42_ui32 = constant 42 : ui32 + // CHECK: %f = constant @func_with_ops : (f32) -> () %10 = constant @func_with_ops : (f32) -> ()