[llvm] r222959 - Remove some unnecessary vector::reserve/assign calls.
David Blaikie
dblaikie at gmail.com
Sat Nov 29 10:13:42 PST 2014
Author: dblaikie
Date: Sat Nov 29 12:13:42 2014
New Revision: 222959
URL: http://llvm.org/viewvc/llvm-project?rev=222959&view=rev
Log:
Remove some unnecessary vector::reserve/assign calls.
Modified:
llvm/trunk/utils/TableGen/CodeGenRegisters.cpp
Modified: llvm/trunk/utils/TableGen/CodeGenRegisters.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenRegisters.cpp?rev=222959&r1=222958&r2=222959&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenRegisters.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenRegisters.cpp Sat Nov 29 12:13:42 2014
@@ -944,15 +944,11 @@ CodeGenRegBank::CodeGenRegBank(RecordKee
std::vector<Record*> Tups =
Records.getAllDerivedDefinitions("RegisterTuples");
- std::vector<Record*> TupRegsCopy;
- for (unsigned i = 0, e = Tups.size(); i != e; ++i) {
- const std::vector<Record*> *TupRegs = Sets.expand(Tups[i]);
- TupRegsCopy.reserve(TupRegs->size());
- TupRegsCopy.assign(TupRegs->begin(), TupRegs->end());
- std::sort(TupRegsCopy.begin(), TupRegsCopy.end(), LessRecordRegister());
- for (unsigned j = 0, je = TupRegsCopy.size(); j != je; ++j)
- getReg((TupRegsCopy)[j]);
- TupRegsCopy.clear();
+ for (Record *R : Tups) {
+ std::vector<Record *> TupRegs = *Sets.expand(R);
+ std::sort(TupRegs.begin(), TupRegs.end(), LessRecordRegister());
+ for (Record *RC : TupRegs)
+ getReg(RC);
}
// Now all the registers are known. Build the object graph of explicit
More information about the llvm-commits
mailing list