diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index 3a43b1edcaba..4eb6e75d09fa 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -1846,11 +1846,10 @@ static void splitAsyncCoroutine(Function &F, coro::Shape &Shape, auto ProjectionFunctionName = Suspend->getAsyncContextProjectionFunction()->getName(); bool UseSwiftMangling = false; - if (ProjectionFunctionName.equals("__swift_async_resume_project_context")) { + if (ProjectionFunctionName == "__swift_async_resume_project_context") { ResumeNameSuffix = "TQ"; UseSwiftMangling = true; - } else if (ProjectionFunctionName.equals( - "__swift_async_resume_get_context")) { + } else if (ProjectionFunctionName == "__swift_async_resume_get_context") { ResumeNameSuffix = "TY"; UseSwiftMangling = true; } diff --git a/llvm/lib/Transforms/IPO/BlockExtractor.cpp b/llvm/lib/Transforms/IPO/BlockExtractor.cpp index 0c406aa9822e..ec1be35a3316 100644 --- a/llvm/lib/Transforms/IPO/BlockExtractor.cpp +++ b/llvm/lib/Transforms/IPO/BlockExtractor.cpp @@ -142,9 +142,8 @@ bool BlockExtractor::runOnModule(Module &M) { report_fatal_error("Invalid function name specified in the input file", /*GenCrashDiag=*/false); for (const auto &BBInfo : BInfo.second) { - auto Res = llvm::find_if(*F, [&](const BasicBlock &BB) { - return BB.getName().equals(BBInfo); - }); + auto Res = llvm::find_if( + *F, [&](const BasicBlock &BB) { return BB.getName() == BBInfo; }); if (Res == F->end()) report_fatal_error("Invalid block name specified in the input file", /*GenCrashDiag=*/false); diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index b333b1582e80..2269c2e0fffa 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -2125,7 +2125,7 @@ static bool annotateAllFunctions( HotFunctions.push_back(&F); if (PGOViewCounts != PGOVCT_None && (ViewBlockFreqFuncName.empty() || - F.getName().equals(ViewBlockFreqFuncName))) { + F.getName() == ViewBlockFreqFuncName)) { LoopInfo LI{DominatorTree(F)}; std::unique_ptr NewBPI = std::make_unique(F, LI); @@ -2140,7 +2140,7 @@ static bool annotateAllFunctions( } if (PGOViewRawCounts != PGOVCT_None && (ViewBlockFreqFuncName.empty() || - F.getName().equals(ViewBlockFreqFuncName))) { + F.getName() == ViewBlockFreqFuncName)) { if (PGOViewRawCounts == PGOVCT_Graph) if (ViewBlockFreqFuncName.empty()) WriteGraph(&Func, Twine("PGORawCounts_") + Func.getFunc().getName()); diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp index 96ecd7f368a0..5f0a9b22c3ee 100644 --- a/llvm/lib/Transforms/Scalar/ADCE.cpp +++ b/llvm/lib/Transforms/Scalar/ADCE.cpp @@ -350,7 +350,7 @@ bool AggressiveDeadCodeElimination::isInstrumentsConstant(Instruction &I) { // TODO -- move this test into llvm::isInstructionTriviallyDead if (CallInst *CI = dyn_cast(&I)) if (Function *Callee = CI->getCalledFunction()) - if (Callee->getName().equals(getInstrProfValueProfFuncName())) + if (Callee->getName() == getInstrProfValueProfFuncName()) if (isa(CI->getArgOperand(0))) return true; return false; diff --git a/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp b/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp index f5c9aaa4f20b..77d155d7e78e 100644 --- a/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp +++ b/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp @@ -591,7 +591,7 @@ static Instruction *findLocationForEntrySafepoint(Function &F, const char GCSafepointPollName[] = "gc.safepoint_poll"; static bool isGCSafepointPoll(Function &F) { - return F.getName().equals(GCSafepointPollName); + return F.getName() == GCSafepointPollName; } /// Returns true if this function should be rewritten to include safepoint diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index 330b464667ee..286273c897aa 100644 --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -1685,10 +1685,10 @@ makeStatepointExplicitImpl(CallBase *Call, /* to replace */ // Pass through the requested lowering if any. The default is live-through. StringRef DeoptLowering = getDeoptLowering(Call); - if (DeoptLowering.equals("live-in")) + if (DeoptLowering == "live-in") Flags |= uint32_t(StatepointFlags::DeoptLiveIn); else { - assert(DeoptLowering.equals("live-through") && "Unsupported value!"); + assert(DeoptLowering == "live-through" && "Unsupported value!"); } FunctionCallee CallTarget(Call->getFunctionType(), Call->getCalledOperand()); diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp index e9969ae64147..20978cf2e748 100644 --- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp @@ -1077,7 +1077,7 @@ MDNode *llvm::GetUnrollMetadata(MDNode *LoopID, StringRef Name) { if (!S) continue; - if (Name.equals(S->getString())) + if (Name == S->getString()) return MD; } return nullptr; diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index f783b708fa9e..cc883a7dc292 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -222,7 +222,7 @@ void llvm::addStringMetadataToLoop(Loop *TheLoop, const char *StringMD, // If it is of form key = value, try to parse it. if (Node->getNumOperands() == 2) { MDString *S = dyn_cast(Node->getOperand(0)); - if (S && S->getString().equals(StringMD)) { + if (S && S->getString() == StringMD) { ConstantInt *IntMD = mdconst::extract_or_null(Node->getOperand(1)); if (IntMD && IntMD->getSExtValue() == V) diff --git a/llvm/lib/Transforms/Utils/SymbolRewriter.cpp b/llvm/lib/Transforms/Utils/SymbolRewriter.cpp index 8b4f34209e85..d52d52a9b7d3 100644 --- a/llvm/lib/Transforms/Utils/SymbolRewriter.cpp +++ b/llvm/lib/Transforms/Utils/SymbolRewriter.cpp @@ -308,11 +308,11 @@ bool RewriteMapParser::parseEntry(yaml::Stream &YS, yaml::KeyValueNode &Entry, } RewriteType = Key->getValue(KeyStorage); - if (RewriteType.equals("function")) + if (RewriteType == "function") return parseRewriteFunctionDescriptor(YS, Key, Value, DL); - else if (RewriteType.equals("global variable")) + else if (RewriteType == "global variable") return parseRewriteGlobalVariableDescriptor(YS, Key, Value, DL); - else if (RewriteType.equals("global alias")) + else if (RewriteType == "global alias") return parseRewriteGlobalAliasDescriptor(YS, Key, Value, DL); YS.printError(Entry.getKey(), "unknown rewrite type"); @@ -348,7 +348,7 @@ parseRewriteFunctionDescriptor(yaml::Stream &YS, yaml::ScalarNode *K, } KeyValue = Key->getValue(KeyStorage); - if (KeyValue.equals("source")) { + if (KeyValue == "source") { std::string Error; Source = std::string(Value->getValue(ValueStorage)); @@ -356,11 +356,11 @@ parseRewriteFunctionDescriptor(yaml::Stream &YS, yaml::ScalarNode *K, YS.printError(Field.getKey(), "invalid regex: " + Error); return false; } - } else if (KeyValue.equals("target")) { + } else if (KeyValue == "target") { Target = std::string(Value->getValue(ValueStorage)); - } else if (KeyValue.equals("transform")) { + } else if (KeyValue == "transform") { Transform = std::string(Value->getValue(ValueStorage)); - } else if (KeyValue.equals("naked")) { + } else if (KeyValue == "naked") { std::string Undecorated; Undecorated = std::string(Value->getValue(ValueStorage)); @@ -417,7 +417,7 @@ parseRewriteGlobalVariableDescriptor(yaml::Stream &YS, yaml::ScalarNode *K, } KeyValue = Key->getValue(KeyStorage); - if (KeyValue.equals("source")) { + if (KeyValue == "source") { std::string Error; Source = std::string(Value->getValue(ValueStorage)); @@ -425,9 +425,9 @@ parseRewriteGlobalVariableDescriptor(yaml::Stream &YS, yaml::ScalarNode *K, YS.printError(Field.getKey(), "invalid regex: " + Error); return false; } - } else if (KeyValue.equals("target")) { + } else if (KeyValue == "target") { Target = std::string(Value->getValue(ValueStorage)); - } else if (KeyValue.equals("transform")) { + } else if (KeyValue == "transform") { Transform = std::string(Value->getValue(ValueStorage)); } else { YS.printError(Field.getKey(), "unknown Key for Global Variable"); @@ -480,7 +480,7 @@ parseRewriteGlobalAliasDescriptor(yaml::Stream &YS, yaml::ScalarNode *K, } KeyValue = Key->getValue(KeyStorage); - if (KeyValue.equals("source")) { + if (KeyValue == "source") { std::string Error; Source = std::string(Value->getValue(ValueStorage)); @@ -488,9 +488,9 @@ parseRewriteGlobalAliasDescriptor(yaml::Stream &YS, yaml::ScalarNode *K, YS.printError(Field.getKey(), "invalid regex: " + Error); return false; } - } else if (KeyValue.equals("target")) { + } else if (KeyValue == "target") { Target = std::string(Value->getValue(ValueStorage)); - } else if (KeyValue.equals("transform")) { + } else if (KeyValue == "transform") { Transform = std::string(Value->getValue(ValueStorage)); } else { YS.printError(Field.getKey(), "unknown key for Global Alias"); diff --git a/llvm/unittests/Transforms/Utils/LocalTest.cpp b/llvm/unittests/Transforms/Utils/LocalTest.cpp index b871603328b2..b28ba2b1b446 100644 --- a/llvm/unittests/Transforms/Utils/LocalTest.cpp +++ b/llvm/unittests/Transforms/Utils/LocalTest.cpp @@ -1196,7 +1196,7 @@ TEST(Local, SimplifyCFGWithNullAC) { // Obtain BasicBlock of interest to this test, %test.bb. BasicBlock *TestBB = nullptr; for (BasicBlock &BB : F) { - if (BB.getName().equals("test.bb")) { + if (BB.getName() == "test.bb") { TestBB = &BB; break; }