[llvm] [RISCV][NFC] Use raw_svector_ostream to construct key of SubtargetMap (PR #72964)

Wang Pengcheng via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 23:19:48 PST 2023


https://github.com/wangpc-pp created https://github.com/llvm/llvm-project/pull/72964

To simplify some code.


>From 3326d906c6b54dbd37e8df64e069baaf51c4f0a7 Mon Sep 17 00:00:00 2001
From: wangpc <wangpengcheng.pp at bytedance.com>
Date: Tue, 21 Nov 2023 15:18:59 +0800
Subject: [PATCH] [RISCV][NFC] Use raw_svector_ostream to construct key of
 SubtargetMap

To simplify some code.
---
 llvm/lib/Target/RISCV/RISCVTargetMachine.cpp | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index 524c1a5ca50c5d9..7fed855ff625a86 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -208,13 +208,8 @@ RISCVTargetMachine::getSubtargetImpl(const Function &F) const {
       llvm::bit_floor((RVVBitsMax < 64 || RVVBitsMax > 65536) ? 0 : RVVBitsMax);
 
   SmallString<512> Key;
-  Key += "RVVMin";
-  Key += std::to_string(RVVBitsMin);
-  Key += "RVVMax";
-  Key += std::to_string(RVVBitsMax);
-  Key += CPU;
-  Key += TuneCPU;
-  Key += FS;
+  raw_svector_ostream(Key) << "RVVMin" << RVVBitsMin << "RVVMax" << RVVBitsMax
+                           << CPU << TuneCPU << FS;
   auto &I = SubtargetMap[Key];
   if (!I) {
     // This needs to be done before we create a new subtarget since any



More information about the llvm-commits mailing list