diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
index 7f4e2ffa5262..37d8d73e3dc9 100644
--- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
+++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
@@ -2644,7 +2644,7 @@ static void printOpWithOffsetsSizesAndStrides(
     OpAsmPrinter &p, OpType op,
     llvm::function_ref<void(OpAsmPrinter &p, OpType op)> printExtraOperands =
         [](OpAsmPrinter &p, OpType op) {},
-    StringLiteral resultTypeKeyword = "to") {
+    StringRef resultTypeKeyword = "to") {
   int stdDotLen = StandardOpsDialect::getDialectNamespace().size() + 1;
   p << op.getOperation()->getName().getStringRef().drop_front(stdDotLen) << ' ';
   p << op.source();
@@ -2677,7 +2677,7 @@ static ParseResult parseOpWithOffsetsSizesAndStrides(
     std::function<ParseResult(OpAsmParser &p,
                               OpAsmParser::OperandType &dstInfo)>
         parseExtraOperand = nullptr,
-    StringLiteral resultTypeKeyword = "to") {
+    StringRef resultTypeKeyword = "to") {
   OpAsmParser::OperandType srcInfo, dstInfo;
   SmallVector<OpAsmParser::OperandType, 4> offsetsInfo, sizesInfo, stridesInfo;
   auto indexType = parser.getBuilder().getIndexType();