[llvm] [RISCV][llvm-exegesis] Simplfy copying a SmallVector to a std::vector. NFC (PR #122988)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 15:56:56 PST 2025


https://github.com/topperc created https://github.com/llvm/llvm-project/pull/122988

None

>From a236a233718aebfa9100eab728090494cb02dba7 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Tue, 14 Jan 2025 15:55:52 -0800
Subject: [PATCH] [RISCV][llvm-exegesis] Simplfy copying a SmallVector to a
 std::vector. NFC

---
 llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp b/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
index 5636782bdf7f6f..d55db9af8a9bd8 100644
--- a/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
@@ -32,13 +32,11 @@ namespace {
 static std::vector<MCInst> loadIntReg(const MCSubtargetInfo &STI, unsigned Reg,
                                       const APInt &Value) {
   SmallVector<MCInst, 8> MCInstSeq;
-  std::vector<MCInst> MatIntInstrs;
   MCRegister DestReg = Reg;
 
   RISCVMatInt::generateMCInstSeq(Value.getSExtValue(), STI, DestReg, MCInstSeq);
-  MatIntInstrs.resize(MCInstSeq.size());
-  std::copy(MCInstSeq.begin(), MCInstSeq.end(), MatIntInstrs.begin());
 
+  std::vector<MCInst> MatIntInstrs(MCInstSeq.begin(), MCInstSeq.end());
   return MatIntInstrs;
 }
 



More information about the llvm-commits mailing list