[llvm] [TableGen] Use vector constructor instead of calling append or emplace_back on an empty vector. NFC (PR #123442)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 17 20:18:47 PST 2025
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/123442
None
>From ba040a619f55a26e329311907faf490ab7b25dc8 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Fri, 17 Jan 2025 20:16:23 -0800
Subject: [PATCH] [TableGen] Use vector constructor instead of calling append
or emplace_back on an empty vector. NFC
---
llvm/utils/TableGen/Common/CodeGenSchedule.cpp | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
index a5ca060533bcef..ebe066901d2d10 100644
--- a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
@@ -1711,24 +1711,23 @@ void CodeGenSchedModels::inferFromRW(ArrayRef<unsigned> OperWrites,
dbgs() << ") ");
// Create a seed transition with an empty PredTerm and the expanded sequences
// of SchedWrites for the current SchedClass.
- std::vector<PredTransition> LastTransitions;
- LastTransitions.emplace_back();
+ std::vector<PredTransition> LastTransitions(1);
for (unsigned WriteIdx : OperWrites) {
IdxVec WriteSeq;
expandRWSequence(WriteIdx, WriteSeq, /*IsRead=*/false);
- LastTransitions[0].WriteSequences.emplace_back();
- SmallVectorImpl<unsigned> &Seq = LastTransitions[0].WriteSequences.back();
- Seq.append(WriteSeq.begin(), WriteSeq.end());
+ SmallVectorImpl<unsigned> &Seq =
+ LastTransitions[0].WriteSequences.emplace_back(WriteSeq.begin(),
+ WriteSeq.end());
LLVM_DEBUG(dbgs() << "("; dumpIdxVec(Seq); dbgs() << ") ");
}
LLVM_DEBUG(dbgs() << " Reads: ");
for (unsigned ReadIdx : OperReads) {
IdxVec ReadSeq;
expandRWSequence(ReadIdx, ReadSeq, /*IsRead=*/true);
- LastTransitions[0].ReadSequences.emplace_back();
- SmallVectorImpl<unsigned> &Seq = LastTransitions[0].ReadSequences.back();
- Seq.append(ReadSeq.begin(), ReadSeq.end());
+ SmallVectorImpl<unsigned> &Seq =
+ LastTransitions[0].ReadSequences.emplace_back(ReadSeq.begin(),
+ ReadSeq.end());
LLVM_DEBUG(dbgs() << "("; dumpIdxVec(Seq); dbgs() << ") ");
}
LLVM_DEBUG(dbgs() << '\n');
More information about the llvm-commits
mailing list