Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/llvm/ADT/iterator_range.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class iterator_range {

IteratorT begin() const { return begin_iterator; }
IteratorT end() const { return end_iterator; }
bool empty() const { return begin_iterator == end_iterator; }
};

/// Convenience function for iterating over sub-ranges.
Expand Down
2 changes: 1 addition & 1 deletion lib/Analysis/LazyCallGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ LazyCallGraph::RefSCC::switchInternalEdgeToCall(

// If the merge range is empty, then adding the edge didn't actually form any
// new cycles. We're done.
if (empty(MergeRange)) {
if (MergeRange.empty()) {
// Now that the SCC structure is finalized, flip the kind to call.
SourceN->setEdgeKind(TargetN, Edge::Call);
return false; // No new cycle.
Expand Down
4 changes: 2 additions & 2 deletions lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ void DwarfDebug::finalizeModuleInfo() {
// If we're splitting the dwarf out now that we've got the entire
// CU then add the dwo id to it.
auto *SkCU = TheCU.getSkeleton();
if (useSplitDwarf() && !empty(TheCU.getUnitDie().children())) {
if (useSplitDwarf() && !TheCU.getUnitDie().children().empty()) {
finishUnitAttributes(TheCU.getCUNode(), TheCU);
TheCU.addString(TheCU.getUnitDie(), dwarf::DW_AT_GNU_dwo_name,
Asm->TM.Options.MCOptions.SplitDwarfFile);
Expand Down Expand Up @@ -954,7 +954,7 @@ void DwarfDebug::finalizeModuleInfo() {
// is a bit pessimistic under LTO.
if (!AddrPool.isEmpty() &&
(getDwarfVersion() >= 5 ||
(SkCU && !empty(TheCU.getUnitDie().children()))))
(SkCU && !TheCU.getUnitDie().children().empty())))
U.addAddrTableBase();

if (getDwarfVersion() >= 5) {
Expand Down
2 changes: 1 addition & 1 deletion lib/CodeGen/GlobalISel/InstructionSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ bool InstructionSelector::isObviouslySafeToFold(MachineInstr &MI,
return true;

return !MI.mayLoadOrStore() && !MI.mayRaiseFPException() &&
!MI.hasUnmodeledSideEffects() && empty(MI.implicit_operands());
!MI.hasUnmodeledSideEffects() && MI.implicit_operands().empty();
}
2 changes: 1 addition & 1 deletion lib/CodeGen/GlobalISel/LegalizerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ LegalizeRuleSet &LegalizerInfo::getActionDefinitionsBuilder(
std::initializer_list<unsigned> Opcodes) {
unsigned Representative = *Opcodes.begin();

assert(!empty(Opcodes) && Opcodes.begin() + 1 != Opcodes.end() &&
assert(!llvm::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)
Expand Down
2 changes: 1 addition & 1 deletion lib/CodeGen/GlobalISel/RegBankSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ bool RegBankSelect::repairReg(
"need new vreg for each breakdown");

// An empty range of new register means no repairing.
assert(!empty(NewVRegs) && "We should not have to repair");
assert(!NewVRegs.empty() && "We should not have to repair");

MachineInstr *MI;
if (ValMapping.NumBreakDowns == 1) {
Expand Down
2 changes: 1 addition & 1 deletion lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,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 (empty(NewRegs)) {
if (NewRegs.empty()) {
LLVM_DEBUG(dbgs() << " has not been repaired, nothing to be done\n");
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ExecutionEngine/Orc/ExecutionUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ iterator_range<CtorDtorIterator> getDestructors(const Module &M) {
}

void CtorDtorRunner::add(iterator_range<CtorDtorIterator> CtorDtors) {
if (empty(CtorDtors))
if (CtorDtors.empty())
return;

MangleAndInterner Mangle(
Expand Down
2 changes: 1 addition & 1 deletion lib/IR/DebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ bool DebugInfoFinder::addScope(DIScope *Scope) {
}

static MDNode *stripDebugLocFromLoopID(MDNode *N) {
assert(!empty(N->operands()) && "Missing self reference?");
assert(!N->operands().empty() && "Missing self reference?");

// if there is no debug location, we do not have to rewrite this MDNode.
if (std::none_of(N->op_begin() + 1, N->op_end(), [](const MDOperand &Op) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Target/BPF/BPFAsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ bool BPFAsmPrinter::doInitialization(Module &M) {
AsmPrinter::doInitialization(M);

// Only emit BTF when debuginfo available.
if (MAI->doesSupportDebugInformation() && !empty(M.debug_compile_units())) {
if (MAI->doesSupportDebugInformation() && !M.debug_compile_units().empty()) {
Handlers.emplace_back(llvm::make_unique<BTFDebug>(this), "emit",
"Debug Info Emission", "BTF", "BTF Emission");
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Target/PowerPC/PPCInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2282,7 +2282,7 @@ void PPCInstrInfo::replaceInstrOperandWithImm(MachineInstr &MI,
unsigned InUseReg = MI.getOperand(OpNo).getReg();
MI.getOperand(OpNo).ChangeToImmediate(Imm);

if (empty(MI.implicit_operands()))
if (MI.implicit_operands().empty())
return;

// We need to make sure that the MI didn't have any implicit use
Expand Down
4 changes: 2 additions & 2 deletions lib/Transforms/IPO/PartialInlining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ std::pair<bool, Function *> PartialInlinerImpl::unswitchFunction(Function *F) {
if (PSI->isFunctionEntryCold(F))
return {false, nullptr};

if (empty(F->users()))
if (F->users().empty())
return {false, nullptr};

OptimizationRemarkEmitter ORE(F);
Expand Down Expand Up @@ -1374,7 +1374,7 @@ bool PartialInlinerImpl::tryPartialInline(FunctionCloner &Cloner) {
return false;
}

assert(empty(Cloner.OrigFunc->users()) &&
assert(Cloner.OrigFunc->users().empty() &&
"F's users should all be replaced!");

std::vector<User *> Users(Cloner.ClonedFunc->user_begin(),
Expand Down
2 changes: 1 addition & 1 deletion lib/Transforms/Scalar/NewGVN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ NewGVN::performSymbolicPHIEvaluation(ArrayRef<ValPair> PHIOps,
return true;
});
// If we are left with no operands, it's dead.
if (empty(Filtered)) {
if (Filtered.empty()) {
// If it has undef at this point, it means there are no-non-undef arguments,
// and thus, the value of the phi node must be undef.
if (HasUndef) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Transforms/Utils/PredicateInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ Value *PredicateInfo::materializeStack(unsigned int &Counter,
if (isa<PredicateWithEdge>(ValInfo)) {
IRBuilder<> B(getBranchTerminator(ValInfo));
Function *IF = getCopyDeclaration(F.getParent(), Op->getType());
if (empty(IF->users()))
if (IF->users().empty())
CreatedDeclarations.insert(IF);
CallInst *PIC =
B.CreateCall(IF, Op, Op->getName() + "." + Twine(Counter++));
Expand All @@ -536,7 +536,7 @@ Value *PredicateInfo::materializeStack(unsigned int &Counter,
"Should not have gotten here without it being an assume");
IRBuilder<> B(PAssume->AssumeInst);
Function *IF = getCopyDeclaration(F.getParent(), Op->getType());
if (empty(IF->users()))
if (IF->users().empty())
CreatedDeclarations.insert(IF);
CallInst *PIC = B.CreateCall(IF, Op);
PredicateMap.insert({PIC, ValInfo});
Expand Down
2 changes: 1 addition & 1 deletion lib/Transforms/Utils/SimplifyCFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5260,7 +5260,7 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,

// Figure out the corresponding result for each case value and phi node in the
// common destination, as well as the min and max case values.
assert(!empty(SI->cases()));
assert(!SI->cases().empty());
SwitchInst::CaseIt CI = SI->case_begin();
ConstantInt *MinCaseVal = CI->getCaseValue();
ConstantInt *MaxCaseVal = CI->getCaseValue();
Expand Down