[llvm] 0153b49 - [Scalar] Avoid creating temporary instances of std::string (NFC) (#140327)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 23:52:06 PDT 2025


Author: Kazu Hirata
Date: 2025-05-16T23:52:03-07:00
New Revision: 0153b49f32c251ac34a478815f81c92975529b5d

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

LOG: [Scalar] Avoid creating temporary instances of std::string (NFC) (#140327)

ExprLinearizer::write takes StringRef and immediately sends the
content to the stream without hanging onto the pointer, so we do not
need to create temporary instances of std::string.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
index 1aceb5098eafb..56d4be513ea6f 100644
--- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
@@ -2446,10 +2446,10 @@ class LowerMatrixIntrinsics {
         return;
       } else {
         Ops.append(I->value_op_begin(), I->value_op_end());
-        write(std::string(I->getOpcodeName()));
+        write(I->getOpcodeName());
       }
 
-      write(std::string("("));
+      write("(");
 
       unsigned NumOpsToBreak = 1;
       if (match(Expr, m_Intrinsic<Intrinsic::matrix_column_major_load>()))


        


More information about the llvm-commits mailing list