[llvm] [RISCV][llvm-exegesis] Simplify copying a SmallVector to a std::vector. NFC (PR #122988)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 14 15:57:29 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-tools-llvm-exegesis
Author: Craig Topper (topperc)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/122988.diff
1 Files Affected:
- (modified) llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp (+1-3)
``````````diff
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;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/122988
More information about the llvm-commits
mailing list