diff options
author | Craig Topper <craig.topper@gmail.com> | 2016-01-13 07:20:10 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2016-01-13 07:20:10 +0000 |
commit | 4f1f11527ea9c093e32ef407eaf0adc25e45e573 (patch) | |
tree | 4346f5140680743816576e06a049469930bb04b6 | |
parent | df39060f9f6324e82b7545fec21728b0800f735d (diff) | |
download | bcm5719-llvm-4f1f11527ea9c093e32ef407eaf0adc25e45e573.tar.gz bcm5719-llvm-4f1f11527ea9c093e32ef407eaf0adc25e45e573.zip |
[TableGen] Use std::remove_if instead of an n^2 loop. NFC
llvm-svn: 257581
-rw-r--r-- | llvm/utils/TableGen/AsmWriterEmitter.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index 10864246abd..a7fc7f3c3ea 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -478,14 +478,11 @@ void AsmWriterEmitter::EmitPrintInstruction(raw_ostream &O) { } // Okay, delete instructions with no operand info left. - for (unsigned i = 0, e = Instructions.size(); i != e; ++i) { - // Entire instruction has been emitted? - AsmWriterInst &Inst = Instructions[i]; - if (Inst.Operands.empty()) { - Instructions.erase(Instructions.begin()+i); - --i; --e; - } - } + auto I = std::remove_if(Instructions.begin(), Instructions.end(), + [](AsmWriterInst &Inst) { + return Inst.Operands.empty(); + }); + Instructions.erase(I, Instructions.end()); // Because this is a vector, we want to emit from the end. Reverse all of the |