aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-04-30 12:23:31 -0700
committerGitHub <noreply@github.com>2024-04-30 12:23:31 -0700
commit4e6f6fda8b05524ccdb5a3e42c6c15ddef2454b6 (patch)
treed20291dc8d954226853ad152356fe0c7f7d57caf /llvm/lib/IR/Verifier.cpp
parent9b07a035f1802e826d2186eae1875d010048618a (diff)
downloadllvm-4e6f6fda8b05524ccdb5a3e42c6c15ddef2454b6.zip
llvm-4e6f6fda8b05524ccdb5a3e42c6c15ddef2454b6.tar.gz
llvm-4e6f6fda8b05524ccdb5a3e42c6c15ddef2454b6.tar.bz2
[IR] Use StringRef::operator== instead of StringRef::equals (NFC) (#90550)
I'm planning to remove StringRef::equals in favor of StringRef::operator==. - StringRef::operator== outnumbers StringRef::equals by a factor of 22 under llvm/ in terms of their usage. - The elimination of StringRef::equals brings StringRef closer to std::string_view, which has operator== but not equals. - S == "foo" is more readable than S.equals("foo"), especially for !Long.Expression.equals("str") vs Long.Expression != "str".
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 430e2ce..16ed167 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2379,8 +2379,8 @@ void Verifier::verifyFunctionMetadata(
"expected string with name of the !prof annotation", MD);
MDString *MDS = cast<MDString>(MD->getOperand(0));
StringRef ProfName = MDS->getString();
- Check(ProfName.equals("function_entry_count") ||
- ProfName.equals("synthetic_function_entry_count"),
+ Check(ProfName == "function_entry_count" ||
+ ProfName == "synthetic_function_entry_count",
"first operand should be 'function_entry_count'"
" or 'synthetic_function_entry_count'",
MD);
@@ -4785,7 +4785,7 @@ void Verifier::visitProfMetadata(Instruction &I, MDNode *MD) {
StringRef ProfName = MDS->getString();
// Check consistency of !prof branch_weights metadata.
- if (ProfName.equals("branch_weights")) {
+ if (ProfName == "branch_weights") {
if (isa<InvokeInst>(&I)) {
Check(MD->getNumOperands() == 2 || MD->getNumOperands() == 3,
"Wrong number of InvokeInst branch_weights operands", MD);