Author: Kazu Hirata Date: 2021-01-16T09:40:55-08:00 New Revision: 2082b10d100e8dbaffc2ba8f497db5d2ab61beb2
URL: https://github.com/llvm/llvm-project/commit/2082b10d100e8dbaffc2ba8f497db5d2ab61beb2 DIFF: https://github.com/llvm/llvm-project/commit/2082b10d100e8dbaffc2ba8f497db5d2ab61beb2.diff LOG: [llvm] Use *::empty (NFC) Added: Modified: llvm/lib/Analysis/CGSCCPassManager.cpp llvm/lib/CodeGen/BranchFolding.cpp llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp llvm/lib/CodeGen/PHIElimination.cpp llvm/lib/CodeGen/RegisterScavenging.cpp llvm/lib/Object/SymbolSize.cpp llvm/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp llvm/lib/Target/ARM/ARMConstantIslandPass.cpp llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp llvm/lib/Target/X86/X86CmovConversion.cpp llvm/lib/Target/X86/X86ISelLowering.cpp llvm/lib/Transforms/Scalar/SROA.cpp llvm/tools/llvm-exegesis/lib/Target.cpp llvm/tools/llvm-readobj/ELFDumper.cpp Removed: ################################################################################ diff --git a/llvm/lib/Analysis/CGSCCPassManager.cpp b/llvm/lib/Analysis/CGSCCPassManager.cpp index 4aa7a4b2a61e..3230e9036b8e 100644 --- a/llvm/lib/Analysis/CGSCCPassManager.cpp +++ b/llvm/lib/Analysis/CGSCCPassManager.cpp @@ -833,7 +833,7 @@ incorporateNewSCCRange(const SCCRangeT &NewSCCRange, LazyCallGraph &G, CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR) { using SCC = LazyCallGraph::SCC; - if (NewSCCRange.begin() == NewSCCRange.end()) + if (NewSCCRange.empty()) return C; // Add the current SCC to the worklist as its shape has changed. diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index fd0936ae05e8..fd3f465fb390 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -1403,7 +1403,7 @@ bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) { LLVM_DEBUG(dbgs() << "\nMerging into block: " << PrevBB << "From MBB: " << *MBB); // Remove redundant DBG_VALUEs first. - if (PrevBB.begin() != PrevBB.end()) { + if (!PrevBB.empty()) { MachineBasicBlock::iterator PrevBBIter = PrevBB.end(); --PrevBBIter; MachineBasicBlock::iterator MBBIter = MBB->begin(); diff --git a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp index 1171e4b9519d..662bd1a3646f 100644 --- a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp +++ b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp @@ -434,7 +434,7 @@ class StatepointState { // To insert reload at the end of MBB, insert it before last instruction // and then swap them. - assert(MBB->begin() != MBB->end() && "Empty block"); + assert(!MBB->empty() && "Empty block"); --It; TII.loadRegFromStackSlot(*MBB, It, Reg, FI, RC, &TRI); MachineInstr *Reload = It->getPrevNode(); diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp index c486319f142f..8148b64d8443 100644 --- a/llvm/lib/CodeGen/PHIElimination.cpp +++ b/llvm/lib/CodeGen/PHIElimination.cpp @@ -394,8 +394,7 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB, } LiveInterval &DestLI = LIS->getInterval(DestReg); - assert(DestLI.begin() != DestLI.end() && - "PHIs should have nonempty LiveIntervals."); + assert(!DestLI.empty() && "PHIs should have nonempty LiveIntervals."); if (DestLI.endIndex().isDead()) { // A dead PHI's live range begins and ends at the start of the MBB, but // the lowered copy, which will still be dead, needs to begin and end at diff --git a/llvm/lib/CodeGen/RegisterScavenging.cpp b/llvm/lib/CodeGen/RegisterScavenging.cpp index 93e8e27d12aa..a833895c115d 100644 --- a/llvm/lib/CodeGen/RegisterScavenging.cpp +++ b/llvm/lib/CodeGen/RegisterScavenging.cpp @@ -91,7 +91,7 @@ void RegScavenger::enterBasicBlockEnd(MachineBasicBlock &MBB) { LiveUnits.addLiveOuts(MBB); // Move internal iterator at the last instruction of the block. - if (MBB.begin() != MBB.end()) { + if (!MBB.empty()) { MBBI = std::prev(MBB.end()); Tracking = true; } diff --git a/llvm/lib/Object/SymbolSize.cpp b/llvm/lib/Object/SymbolSize.cpp index 84eed4d169d3..97baabec084b 100644 --- a/llvm/lib/Object/SymbolSize.cpp +++ b/llvm/lib/Object/SymbolSize.cpp @@ -48,7 +48,7 @@ llvm::object::computeSymbolSizes(const ObjectFile &O) { if (const auto *E = dyn_cast<ELFObjectFileBase>(&O)) { auto Syms = E->symbols(); - if (Syms.begin() == Syms.end()) + if (Syms.empty()) Syms = E->getDynamicSymbolIterators(); for (ELFSymbolRef Sym : Syms) Ret.push_back({Sym, Sym.getSize()}); diff --git a/llvm/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp b/llvm/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp index 3f76bdd0d680..3530c2b7b717 100644 --- a/llvm/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp +++ b/llvm/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp @@ -441,7 +441,7 @@ MachineInstr *AMDGPUCFGStructurizer::insertInstrBefore(MachineBasicBlock *MBB, const DebugLoc &DL) { MachineInstr *MI = MBB->getParent()->CreateMachineInstr(TII->get(NewOpcode), DL); - if (MBB->begin() != MBB->end()) + if (!MBB->empty()) MBB->insert(MBB->begin(), MI); else MBB->push_back(MI); diff --git a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp index 886bc2965969..e89eb0fb4502 100644 --- a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp +++ b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp @@ -2095,8 +2095,7 @@ static bool jumpTableFollowsTB(MachineInstr *JTMI, MachineInstr *CPEMI) { MachineFunction *MF = MBB->getParent(); ++MBB; - return MBB != MF->end() && MBB->begin() != MBB->end() && - &*MBB->begin() == CPEMI; + return MBB != MF->end() && !MBB->empty() && &*MBB->begin() == CPEMI; } static void RemoveDeadAddBetweenLEAAndJT(MachineInstr *LEAMI, diff --git a/llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp b/llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp index 9e4199b93477..fcc880463925 100644 --- a/llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp +++ b/llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp @@ -1173,7 +1173,7 @@ bool HexagonExpandCondsets::coalesceRegisters(RegisterRef R1, RegisterRef R2) { } L1.addSegment(LiveRange::Segment(I->start, I->end, NewVN)); } - while (L2.begin() != L2.end()) + while (!L2.empty()) L2.removeSegment(*L2.begin()); LIS->removeInterval(R2.Reg); diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp index 13fcc191b82a..b106b8238ebc 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp @@ -692,7 +692,7 @@ class TreeWalkerState { public: explicit TreeWalkerState(MachineInstr *Insert) { const iterator_range<mop_iterator> &Range = Insert->explicit_uses(); - if (Range.begin() != Range.end()) + if (!Range.empty()) Worklist.push_back(reverse(Range)); } @@ -702,10 +702,9 @@ class TreeWalkerState { RangeTy &Range = Worklist.back(); MachineOperand &Op = *Range.begin(); Range = drop_begin(Range, 1); - if (Range.begin() == Range.end()) + if (Range.empty()) Worklist.pop_back(); - assert((Worklist.empty() || - Worklist.back().begin() != Worklist.back().end()) && + assert((Worklist.empty() || !Worklist.back().empty()) && "Empty ranges shouldn't remain in the worklist"); return Op; } @@ -713,7 +712,7 @@ class TreeWalkerState { /// Push Instr's operands onto the stack to be visited. void pushOperands(MachineInstr *Instr) { const iterator_range<mop_iterator> &Range(Instr->explicit_uses()); - if (Range.begin() != Range.end()) + if (!Range.empty()) Worklist.push_back(reverse(Range)); } @@ -732,7 +731,7 @@ class TreeWalkerState { if (Worklist.empty()) return false; const RangeTy &Range = Worklist.back(); - return Range.begin() != Range.end() && Range.begin()->getParent() == Instr; + return !Range.empty() && Range.begin()->getParent() == Instr; } /// Test whether the given register is present on the stack, indicating an diff --git a/llvm/lib/Target/X86/X86CmovConversion.cpp b/llvm/lib/Target/X86/X86CmovConversion.cpp index 434d8b3de4b9..a2de0dc08292 100644 --- a/llvm/lib/Target/X86/X86CmovConversion.cpp +++ b/llvm/lib/Target/X86/X86CmovConversion.cpp @@ -537,7 +537,7 @@ bool X86CmovConverterPass::checkForProfitableCmovCandidates( // This is another conservative check to avoid converting CMOV instruction // used with tree-search like algorithm, where the branch is unpredicted. auto UIs = MRI->use_instructions(MI->defs().begin()->getReg()); - if (UIs.begin() != UIs.end() && ++UIs.begin() == UIs.end()) { + if (!UIs.empty() && ++UIs.begin() == UIs.end()) { unsigned Op = UIs.begin()->getOpcode(); if (Op == X86::MOV64rm || Op == X86::MOV32rm) { WorthOpGroup = false; diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index d2cc2395576a..6bee21747bce 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -21983,8 +21983,7 @@ static bool matchScalarReduction(SDValue Op, ISD::NodeType BinOp, if (M == SrcOpMap.end()) { VT = Src.getValueType(); // Quit if not the same type. - if (SrcOpMap.begin() != SrcOpMap.end() && - VT != SrcOpMap.begin()->first.getValueType()) + if (!SrcOpMap.empty() && VT != SrcOpMap.begin()->first.getValueType()) return false; unsigned NumElts = VT.getVectorNumElements(); APInt EltCount = APInt::getNullValue(NumElts); diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 1a0180a77afb..d111a6ba4241 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -2113,8 +2113,7 @@ static bool isIntegerWideningViable(Partition &P, Type *AllocaTy, // that we cover the alloca. // FIXME: We shouldn't consider split slices that happen to start in the // partition here... - bool WholeAllocaOp = - P.begin() != P.end() ? false : DL.isLegalInteger(SizeInBits); + bool WholeAllocaOp = P.empty() && DL.isLegalInteger(SizeInBits); for (const Slice &S : P) if (!isIntegerWideningViableForSlice(S, P.beginOffset(), AllocaTy, DL, diff --git a/llvm/tools/llvm-exegesis/lib/Target.cpp b/llvm/tools/llvm-exegesis/lib/Target.cpp index 2945c1ec2610..9ff19d57a871 100644 --- a/llvm/tools/llvm-exegesis/lib/Target.cpp +++ b/llvm/tools/llvm-exegesis/lib/Target.cpp @@ -135,8 +135,7 @@ const PfmCountersInfo &ExegesisTarget::getPfmCounters(StringRef CpuName) const { auto Found = llvm::lower_bound(CpuPfmCounters, CpuName); if (Found == CpuPfmCounters.end() || StringRef(Found->CpuName) != CpuName) { // Use the default. - if (CpuPfmCounters.begin() != CpuPfmCounters.end() && - CpuPfmCounters.begin()->CpuName[0] == '\0') { + if (!CpuPfmCounters.empty() && CpuPfmCounters.begin()->CpuName[0] == '\0') { Found = CpuPfmCounters.begin(); // The target specifies a default. } else { return PfmCountersInfo::Default; // No default for the target. diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp index 9351338590ae..5a99359a9cc6 100644 --- a/llvm/tools/llvm-readobj/ELFDumper.cpp +++ b/llvm/tools/llvm-readobj/ELFDumper.cpp @@ -733,7 +733,7 @@ void ELFDumper<ELFT>::printSymbolsHelper(bool IsDynamic) const { toString(SymsOrErr.takeError())); Entries = DotSymtabSec->getEntityCount(); } - if (Syms.begin() == Syms.end()) + if (Syms.empty()) return; // The st_other field has 2 logical parts. The first two bits hold the symbol _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits