diff --git a/llvm/lib/Analysis/BlockFrequencyInfo.cpp b/llvm/lib/Analysis/BlockFrequencyInfo.cpp index ebad8388cbe41..d1b21e8c83f2c 100644 --- a/llvm/lib/Analysis/BlockFrequencyInfo.cpp +++ b/llvm/lib/Analysis/BlockFrequencyInfo.cpp @@ -188,12 +188,11 @@ void BlockFrequencyInfo::calculate(const Function &F, BFI.reset(new ImplType); BFI->calculate(F, BPI, LI); if (ViewBlockFreqPropagationDAG != GVDT_None && - (ViewBlockFreqFuncName.empty() || - F.getName().equals(ViewBlockFreqFuncName))) { + (ViewBlockFreqFuncName.empty() || F.getName() == ViewBlockFreqFuncName)) { view(); } if (PrintBFI && - (PrintBFIFuncName.empty() || F.getName().equals(PrintBFIFuncName))) { + (PrintBFIFuncName.empty() || F.getName() == PrintBFIFuncName)) { print(dbgs()); } } diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp index 6448ed66dc51c..36a2df6459132 100644 --- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp +++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp @@ -1273,9 +1273,8 @@ void BranchProbabilityInfo::calculate(const Function &F, const LoopInfo &LoopI, EstimatedBlockWeight.clear(); SccI.reset(); - if (PrintBranchProb && - (PrintBranchProbFuncName.empty() || - F.getName().equals(PrintBranchProbFuncName))) { + if (PrintBranchProb && (PrintBranchProbFuncName.empty() || + F.getName() == PrintBranchProbFuncName)) { print(dbgs()); } } diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index 3075e5190f8ed..369ab087ffc0f 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/lib/Analysis/LoopInfo.cpp @@ -1032,7 +1032,7 @@ MDNode *llvm::findOptionMDForLoopID(MDNode *LoopID, StringRef Name) { if (!S) continue; // Return the operand node if MDString holds expected metadata. - if (Name.equals(S->getString())) + if (Name == S->getString()) return MD; } diff --git a/llvm/lib/Analysis/MemoryProfileInfo.cpp b/llvm/lib/Analysis/MemoryProfileInfo.cpp index 8f5bc24747b1d..5c09ba9462716 100644 --- a/llvm/lib/Analysis/MemoryProfileInfo.cpp +++ b/llvm/lib/Analysis/MemoryProfileInfo.cpp @@ -86,9 +86,9 @@ AllocationType llvm::memprof::getMIBAllocType(const MDNode *MIB) { // types that can be applied based on the allocation profile data. auto *MDS = dyn_cast(MIB->getOperand(1)); assert(MDS); - if (MDS->getString().equals("cold")) { + if (MDS->getString() == "cold") { return AllocationType::Cold; - } else if (MDS->getString().equals("hot")) { + } else if (MDS->getString() == "hot") { return AllocationType::Hot; } return AllocationType::NotCold; diff --git a/llvm/lib/CodeGen/MIRSampleProfile.cpp b/llvm/lib/CodeGen/MIRSampleProfile.cpp index 42d0aba4b1660..6faa1ad1a7790 100644 --- a/llvm/lib/CodeGen/MIRSampleProfile.cpp +++ b/llvm/lib/CodeGen/MIRSampleProfile.cpp @@ -372,7 +372,7 @@ bool MIRProfileLoaderPass::runOnMachineFunction(MachineFunction &MF) { MF.RenumberBlocks(); if (ViewBFIBefore && ViewBlockLayoutWithBFI != GVDT_None && (ViewBlockFreqFuncName.empty() || - MF.getFunction().getName().equals(ViewBlockFreqFuncName))) { + MF.getFunction().getName() == ViewBlockFreqFuncName)) { MBFI->view("MIR_Prof_loader_b." + MF.getName(), false); } @@ -382,7 +382,7 @@ bool MIRProfileLoaderPass::runOnMachineFunction(MachineFunction &MF) { if (ViewBFIAfter && ViewBlockLayoutWithBFI != GVDT_None && (ViewBlockFreqFuncName.empty() || - MF.getFunction().getName().equals(ViewBlockFreqFuncName))) { + MF.getFunction().getName() == ViewBlockFreqFuncName)) { MBFI->view("MIR_prof_loader_a." + MF.getName(), false); } diff --git a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp index cbebdd87398e4..7ebecc6beb17d 100644 --- a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp +++ b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp @@ -198,12 +198,11 @@ void MachineBlockFrequencyInfo::calculate( MBFI.reset(new ImplType); MBFI->calculate(F, MBPI, MLI); if (ViewMachineBlockFreqPropagationDAG != GVDT_None && - (ViewBlockFreqFuncName.empty() || - F.getName().equals(ViewBlockFreqFuncName))) { + (ViewBlockFreqFuncName.empty() || F.getName() == ViewBlockFreqFuncName)) { view("MachineBlockFrequencyDAGS." + F.getName()); } if (PrintMachineBlockFreq && - (PrintBFIFuncName.empty() || F.getName().equals(PrintBFIFuncName))) { + (PrintBFIFuncName.empty() || F.getName() == PrintBFIFuncName)) { MBFI->print(dbgs()); } } diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp index ef34e920aed50..c0cdeab25f1ca 100644 --- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp +++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp @@ -3500,7 +3500,7 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) { } if (ViewBlockLayoutWithBFI != GVDT_None && (ViewBlockFreqFuncName.empty() || - F->getFunction().getName().equals(ViewBlockFreqFuncName))) { + F->getFunction().getName() == ViewBlockFreqFuncName)) { if (RenumberBlocksBeforeView) MF.RenumberBlocks(); MBFI->view("MBP." + MF.getName(), false); diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index 6e7b67ded23c8..75b3f14e96220 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -2249,7 +2249,7 @@ static int getOpEnabled(bool IsSqrt, EVT VT, StringRef Override) { if (IsDisabled) RecipType = RecipType.substr(1); - if (RecipType.equals(VTName) || RecipType.equals(VTNameNoSize)) + if (RecipType == VTName || RecipType == VTNameNoSize) return IsDisabled ? TargetLoweringBase::ReciprocalEstimate::Disabled : TargetLoweringBase::ReciprocalEstimate::Enabled; } @@ -2299,7 +2299,7 @@ static int getOpRefinementSteps(bool IsSqrt, EVT VT, StringRef Override) { continue; RecipType = RecipType.substr(0, RefPos); - if (RecipType.equals(VTName) || RecipType.equals(VTNameNoSize)) + if (RecipType == VTName || RecipType == VTNameNoSize) return RefSteps; } diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 2a77a683a901f..c0b03b3c9847c 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1031,7 +1031,7 @@ MCSection *TargetLoweringObjectFileELF::getSectionForMachineBasicBlock( // name, or a unique ID for the section. SmallString<128> Name; StringRef FunctionSectionName = MBB.getParent()->getSection()->getName(); - if (FunctionSectionName.equals(".text") || + if (FunctionSectionName == ".text" || FunctionSectionName.starts_with(".text.")) { // Function is in a regular .text section. StringRef FunctionName = MBB.getParent()->getName(); diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp index 265237ee21dc2..c8789cb959fb7 100644 --- a/llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp @@ -512,7 +512,7 @@ bool LVPatterns::matchPattern(StringRef Input, const LVMatchInfo &MatchInfo) { for (const LVMatch &Match : MatchInfo) { switch (Match.Mode) { case LVMatchMode::Match: - Matched = Input.equals(Match.Pattern); + Matched = Input == Match.Pattern; break; case LVMatchMode::NoCase: Matched = Input.equals_insensitive(Match.Pattern); diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp index 2d46414a6986a..c45f0e91c4358 100644 --- a/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp @@ -184,9 +184,8 @@ void LVBinaryReader::mapVirtualAddress(const object::ObjectFile &Obj) { consumeError(SectionNameOrErr.takeError()); continue; } - if ((*SectionNameOrErr).equals(".text") || - (*SectionNameOrErr).equals("CODE") || - (*SectionNameOrErr).equals(".code")) { + if (*SectionNameOrErr == ".text" || *SectionNameOrErr == "CODE" || + *SectionNameOrErr == ".code") { DotTextSectionIndex = Section.getIndex(); // If the object is WebAssembly, update the address offset that // will be added to DWARF DW_AT_* attributes. diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp index 1d01785328825..e89664d360a9a 100644 --- a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp @@ -834,7 +834,7 @@ Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record, // Symbol was created as 'variable'; determine its real kind. Symbol->resetIsVariable(); - if (Local.Name.equals("this")) { + if (Local.Name == "this") { Symbol->setIsParameter(); Symbol->setIsArtificial(); } else { @@ -885,7 +885,7 @@ Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record, Symbol->resetIsVariable(); // Check for the 'this' symbol. - if (Local.Name.equals("this")) { + if (Local.Name == "this") { Symbol->setIsArtificial(); Symbol->setIsParameter(); } else { @@ -1429,7 +1429,7 @@ Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record, LocalSym &Local) { // Be sure the 'this' symbol is marked as 'compiler generated'. if (bool(Local.Flags & LocalSymFlags::IsCompilerGenerated) || - Local.Name.equals("this")) { + Local.Name == "this") { Symbol->setIsArtificial(); Symbol->setIsParameter(); } else { @@ -1669,7 +1669,7 @@ Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record, UDTSym &UDT) { Type->resetIncludeInPrint(); else { StringRef RecordName = getRecordName(Types, UDT.Type); - if (UDT.Name.equals(RecordName)) + if (UDT.Name == RecordName) Type->resetIncludeInPrint(); Type->setType(LogicalVisitor->getElement(StreamTPI, UDT.Type)); } @@ -2740,7 +2740,7 @@ Error LVLogicalVisitor::visitKnownMember(CVMemberRecord &Record, getInnerComponent(NestedTypeName); // We have an already created nested type. Add it to the current scope // and update all its children if any. - if (OuterComponent.size() && OuterComponent.equals(RecordName)) { + if (OuterComponent.size() && OuterComponent == RecordName) { if (!NestedType->getIsScopedAlready()) { Scope->addElement(NestedType); NestedType->setIsScopedAlready(); diff --git a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp index d4fc48e146f61..02a9555858e4e 100644 --- a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp +++ b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp @@ -355,7 +355,7 @@ std::vector SymbolizableObjectFile::findSymbol(StringRef Symbol, uint64_t Offset) const { std::vector Result; for (const SymbolDesc &Sym : Symbols) { - if (Sym.Name.equals(Symbol)) { + if (Sym.Name == Symbol) { uint64_t Addr = Sym.Addr; if (Offset < Sym.Size) Addr += Offset;