diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index 6d0a94d8a3367..73df62abaf023 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -2260,7 +2260,7 @@ class DWARFObjInMemory final : public DWARFObject { continue; } - if (Section.relocation_begin() == Section.relocation_end()) + if (Section.relocations().empty()) continue; // Symbol to [address, section index] cache mapping. diff --git a/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp b/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp index 308dac48cbf7a..09ac0f19a7b07 100644 --- a/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp @@ -261,7 +261,7 @@ class MachOLinkGraphBuilder_arm64 : public MachOLinkGraphBuilder { // Skip relocations virtual sections. if (S.isVirtual()) { - if (S.relocation_begin() != S.relocation_end()) + if (!S.relocations().empty()) return make_error("Virtual section contains " "relocations"); continue; diff --git a/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp index bb5f3ab7ed43c..27209a82eb5f4 100644 --- a/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp @@ -236,7 +236,7 @@ class MachOLinkGraphBuilder_x86_64 : public MachOLinkGraphBuilder { // Skip relocations virtual sections. if (S.isVirtual()) { - if (S.relocation_begin() != S.relocation_end()) + if (!S.relocations().empty()) return make_error("Virtual section contains " "relocations"); continue; diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index ffc7696c3fd50..08d6c78bd1eb1 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -2822,7 +2822,7 @@ Error RuntimeDyldELF::finalizeLoad(const ObjectFile &Obj, // object's sections to GOTs. for (section_iterator SI = Obj.section_begin(), SE = Obj.section_end(); SI != SE; ++SI) { - if (SI->relocation_begin() != SI->relocation_end()) { + if (!SI->relocations().empty()) { Expected RelSecOrErr = SI->getRelocatedSection(); if (!RelSecOrErr) return make_error( diff --git a/llvm/lib/SandboxIR/Value.cpp b/llvm/lib/SandboxIR/Value.cpp index e39bbc44bca00..94b4a4c9a406f 100644 --- a/llvm/lib/SandboxIR/Value.cpp +++ b/llvm/lib/SandboxIR/Value.cpp @@ -22,7 +22,7 @@ Value::Value(ClassID SubclassID, llvm::Value *Val, Context &Ctx) Value::use_iterator Value::use_begin() { llvm::Use *LLVMUse = nullptr; - if (Val->use_begin() != Val->use_end()) + if (!Val->uses().empty()) LLVMUse = &*Val->use_begin(); User *User = LLVMUse != nullptr ? cast_or_null(Ctx.getValue( Val->use_begin()->getUser())) diff --git a/llvm/lib/Target/DirectX/DXContainerGlobals.cpp b/llvm/lib/Target/DirectX/DXContainerGlobals.cpp index b6e8ce7d78b23..26a113d2d5260 100644 --- a/llvm/lib/Target/DirectX/DXContainerGlobals.cpp +++ b/llvm/lib/Target/DirectX/DXContainerGlobals.cpp @@ -103,7 +103,7 @@ GlobalVariable *DXContainerGlobals::computeShaderHash(Module &M) { dxbc::ShaderHash HashData = {0, {0}}; // The Hash's IncludesSource flag gets set whenever the hashed shader includes // debug information. - if (M.debug_compile_units_begin() != M.debug_compile_units_end()) + if (!M.debug_compile_units().empty()) HashData.Flags = static_cast(dxbc::HashFlags::IncludesSource); memcpy(reinterpret_cast(&HashData.Digest), Result.data(), 16); diff --git a/llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp b/llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp index 102f1c65e16c6..14b6bb318e3b2 100644 --- a/llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp +++ b/llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp @@ -330,7 +330,7 @@ bool HexagonCommonGEP::isHandledGepForm(GetElementPtrInst *GepI) { if (!GepI->getType()->isPointerTy()) return false; // No GEPs without any indices. (Is this possible?) - if (GepI->idx_begin() == GepI->idx_end()) + if (GepI->indices().empty()) return false; return true; } diff --git a/llvm/lib/Transforms/Utils/PredicateInfo.cpp b/llvm/lib/Transforms/Utils/PredicateInfo.cpp index de9deab28750f..b22ecbc33e4ff 100644 --- a/llvm/lib/Transforms/Utils/PredicateInfo.cpp +++ b/llvm/lib/Transforms/Utils/PredicateInfo.cpp @@ -721,7 +721,7 @@ PredicateInfo::~PredicateInfo() { CreatedDeclarations.clear(); for (Function *F : FunctionPtrs) { - assert(F->user_begin() == F->user_end() && + assert(F->users().empty() && "PredicateInfo consumer did not remove all SSA copies."); F->eraseFromParent(); } diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 0316c4ba51da6..6ce23e80d1a3d 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -2736,7 +2736,7 @@ void Dumper::printRelocations() { for (const SectionRef &Section : ToolSectionFilter(O, &Ndx)) { if (O.isELF() && (ELFSectionRef(Section).getFlags() & ELF::SHF_ALLOC)) continue; - if (Section.relocation_begin() == Section.relocation_end()) + if (Section.relocations().empty()) continue; Expected SecOrErr = Section.getRelocatedSection(); if (!SecOrErr)