[llvm] [Scalar] Avoid creating temporary instances of std::string (NFC) (PR #140327)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 16 18:25:47 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/140327.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp (+2-2)
``````````diff
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>()))
``````````
</details>
https://github.com/llvm/llvm-project/pull/140327
More information about the llvm-commits
mailing list