[Mlir-commits] [mlir] ac8b53f - [mlir] Apply ClangTidy performance fix

Adrian Kuegel llvmlistbot at llvm.org
Tue Jan 2 02:01:37 PST 2024


Author: Adrian Kuegel
Date: 2024-01-02T10:00:29Z
New Revision: ac8b53fc9232733af4656028fa82fd44397559d0

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

LOG: [mlir] Apply ClangTidy performance fix

- Use '\n' instead of std::endl;

https://clang.llvm.org/extra/clang-tidy/checks/performance/avoid-endl.html

Added: 
    

Modified: 
    mlir/lib/ExecutionEngine/AsyncRuntime.cpp
    mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/ExecutionEngine/AsyncRuntime.cpp b/mlir/lib/ExecutionEngine/AsyncRuntime.cpp
index 9d7e4000fe3bec..24835c555b682b 100644
--- a/mlir/lib/ExecutionEngine/AsyncRuntime.cpp
+++ b/mlir/lib/ExecutionEngine/AsyncRuntime.cpp
@@ -446,7 +446,7 @@ extern "C" int64_t mlirAsyncRuntimGetNumWorkerThreads() {
 
 extern "C" void mlirAsyncRuntimePrintCurrentThreadId() {
   static thread_local std::thread::id thisId = std::this_thread::get_id();
-  std::cout << "Current thread id: " << thisId << std::endl;
+  std::cout << "Current thread id: " << thisId << '\n';
 }
 
 //===----------------------------------------------------------------------===//

diff  --git a/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp b/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
index 2dcc5d22e2291f..e7ac8f161875db 100644
--- a/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
+++ b/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
@@ -450,10 +450,10 @@ void _mlir_ciface_outSparseTensorWriterMetaData(
   assert(dimRank != 0);
   index_type *dimSizes = MEMREF_GET_PAYLOAD(dimSizesRef);
   std::ostream &file = *static_cast<std::ostream *>(p);
-  file << dimRank << " " << nse << std::endl;
+  file << dimRank << " " << nse << '\n';
   for (index_type d = 0; d < dimRank - 1; d++)
     file << dimSizes[d] << " ";
-  file << dimSizes[dimRank - 1] << std::endl;
+  file << dimSizes[dimRank - 1] << '\n';
 }
 
 #define IMPL_OUTNEXT(VNAME, V)                                                 \
@@ -468,7 +468,7 @@ void _mlir_ciface_outSparseTensorWriterMetaData(
     for (index_type d = 0; d < dimRank; d++)                                   \
       file << (dimCoords[d] + 1) << " ";                                       \
     V *value = MEMREF_GET_PAYLOAD(vref);                                       \
-    file << *value << std::endl;                                               \
+    file << *value << '\n';                                                    \
   }
 MLIR_SPARSETENSOR_FOREVERY_V(IMPL_OUTNEXT)
 #undef IMPL_OUTNEXT


        


More information about the Mlir-commits mailing list