[llvm] [Scalar] Avoid creating temporary instances of std::string (NFC) (PR #140327)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri May 16 18:25:14 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/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.
>From 8fb8b094410149ded85464499cd27fc197c90dce Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 16 May 2025 17:58:06 -0700
Subject: [PATCH] [Scalar] Avoid creating temporary instances of std::string
(NFC)
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.
---
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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