[Mlir-commits] [mlir] 395f869 - [mlir] Use llvm::replace (NFC) (#140344)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat May 17 09:09:29 PDT 2025


Author: Kazu Hirata
Date: 2025-05-17T09:09:26-07:00
New Revision: 395f8695da4c0e22d562dc7255be19491d5169b5

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

LOG: [mlir] Use llvm::replace (NFC) (#140344)

Added: 
    

Modified: 
    mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
    mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
    mlir/lib/Transforms/ViewOpGraph.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp b/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
index b109f00c3da13..f2e71e7795c3e 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
@@ -130,7 +130,7 @@ LLVM::InlineAsmOp PtxBuilder::build() {
 
   // Tablegen doesn't accept $, so we use %, but inline assembly uses $.
   // Replace all % with $
-  std::replace(ptxInstruction.begin(), ptxInstruction.end(), '%', '$');
+  llvm::replace(ptxInstruction, '%', '$');
 
   return rewriter.create<LLVM::InlineAsmOp>(
       interfaceOp->getLoc(),

diff  --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index 96106cf7ae120..8a8bd5e232c40 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -2402,7 +2402,7 @@ std::string mlir::linalg::generateLibraryCallName(Operation *op) {
     }
   }
   name.reserve(128);
-  std::replace(name.begin(), name.end(), '.', '_');
+  llvm::replace(name, '.', '_');
   llvm::raw_string_ostream ss(name);
   ss << "_" << fun;
   for (Type t : op->getOperandTypes()) {

diff  --git a/mlir/lib/Transforms/ViewOpGraph.cpp b/mlir/lib/Transforms/ViewOpGraph.cpp
index 75ee3ed74db5e..28fe2a7501c06 100644
--- a/mlir/lib/Transforms/ViewOpGraph.cpp
+++ b/mlir/lib/Transforms/ViewOpGraph.cpp
@@ -292,8 +292,8 @@ class PrintOpPass : public impl::ViewOpGraphBase<PrintOpPass> {
       operand.printAsOperand(os, OpPrintingFlags());
     });
     // Replace % and # with _
-    std::replace(str.begin(), str.end(), '%', '_');
-    std::replace(str.begin(), str.end(), '#', '_');
+    llvm::replace(str, '%', '_');
+    llvm::replace(str, '#', '_');
     return str;
   }
 


        


More information about the Mlir-commits mailing list