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

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 20:04:32 PST 2025


Author: Craig Topper
Date: 2025-01-14T20:04:27-08:00
New Revision: da4ac13acac166738f769a9dfa2be40563d6ff64

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

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

Added: 
    

Modified: 
    llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp

Removed: 
    


################################################################################
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