diff options
| author | Matthias Braun <matze@braunis.de> | 2018-10-31 00:23:23 +0000 |
|---|---|---|
| committer | Matthias Braun <matze@braunis.de> | 2018-10-31 00:23:23 +0000 |
| commit | 9fd397b423ba442808957e65e3ad25a07cd203e4 (patch) | |
| tree | 7145d100b0a62cf322449093f203eb7c9e80c3b8 /llvm/lib/CodeGen | |
| parent | ac0ba8c52493012daabb73512a5739394c37a2dc (diff) | |
| download | bcm5719-llvm-9fd397b423ba442808957e65e3ad25a07cd203e4.tar.gz bcm5719-llvm-9fd397b423ba442808957e65e3ad25a07cd203e4.zip | |
ADT/STLExtras: Introduce llvm::empty; NFC
This is modeled after C++17 std::empty().
Differential Revision: https://reviews.llvm.org/D53909
llvm-svn: 345679
Diffstat (limited to 'llvm/lib/CodeGen')
4 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/InstructionSelector.cpp b/llvm/lib/CodeGen/GlobalISel/InstructionSelector.cpp index 5e77fcbb0ed..38913e4afcb 100644 --- a/llvm/lib/CodeGen/GlobalISel/InstructionSelector.cpp +++ b/llvm/lib/CodeGen/GlobalISel/InstructionSelector.cpp @@ -80,5 +80,5 @@ bool InstructionSelector::isObviouslySafeToFold(MachineInstr &MI, return true; return !MI.mayLoadOrStore() && !MI.hasUnmodeledSideEffects() && - MI.implicit_operands().begin() == MI.implicit_operands().end(); + empty(MI.implicit_operands()); } diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp index b6ed2654bd0..ca776de0a0f 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp @@ -298,8 +298,7 @@ LegalizeRuleSet &LegalizerInfo::getActionDefinitionsBuilder( std::initializer_list<unsigned> Opcodes) { unsigned Representative = *Opcodes.begin(); - assert(Opcodes.begin() != Opcodes.end() && - Opcodes.begin() + 1 != Opcodes.end() && + assert(!empty(Opcodes) && Opcodes.begin() + 1 != Opcodes.end() && "Initializer list must have at least two opcodes"); for (auto I = Opcodes.begin() + 1, E = Opcodes.end(); I != E; ++I) diff --git a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp index 9e2d48d1dc4..6bb48dc2e8a 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp @@ -140,7 +140,7 @@ bool RegBankSelect::repairReg( return false; assert(ValMapping.NumBreakDowns == 1 && "Not yet implemented"); // An empty range of new register means no repairing. - assert(NewVRegs.begin() != NewVRegs.end() && "We should not have to repair"); + assert(!empty(NewVRegs) && "We should not have to repair"); // Assume we are repairing a use and thus, the original reg will be // the source of the repairing. diff --git a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp index dd15567ef1c..28404e52d6e 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp @@ -426,7 +426,7 @@ void RegisterBankInfo::applyDefaultMapping(const OperandsMapper &OpdMapper) { "This mapping is too complex for this function"); iterator_range<SmallVectorImpl<unsigned>::const_iterator> NewRegs = OpdMapper.getVRegs(OpIdx); - if (NewRegs.begin() == NewRegs.end()) { + if (empty(NewRegs)) { LLVM_DEBUG(dbgs() << " has not been repaired, nothing to be done\n"); continue; } |

