Skip to content

Commit b603237

Browse files
[llvm] Use operator==(StringRef, StringRef) (NFC) (#92705)
1 parent 7892d43 commit b603237

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

llvm/lib/Option/OptTable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ OptTable::suggestValueCompletions(StringRef Option, StringRef Arg) const {
197197

198198
std::vector<std::string> Result;
199199
for (StringRef Val : Candidates)
200-
if (Val.starts_with(Arg) && Arg.compare(Val))
200+
if (Val.starts_with(Arg) && Arg != Val)
201201
Result.push_back(std::string(Val));
202202
return Result;
203203
}

llvm/lib/ProfileData/InstrProfCorrelator.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,16 +350,14 @@ void DwarfInstrProfCorrelator<IntPtrT>::correlateProfileDataImpl(
350350
continue;
351351
}
352352
StringRef AnnotationName = *AnnotationNameOrErr;
353-
if (AnnotationName.compare(
354-
InstrProfCorrelator::FunctionNameAttributeName) == 0) {
353+
if (AnnotationName == InstrProfCorrelator::FunctionNameAttributeName) {
355354
if (auto EC =
356355
AnnotationFormValue->getAsCString().moveInto(FunctionName))
357356
consumeError(std::move(EC));
358-
} else if (AnnotationName.compare(
359-
InstrProfCorrelator::CFGHashAttributeName) == 0) {
357+
} else if (AnnotationName == InstrProfCorrelator::CFGHashAttributeName) {
360358
CFGHash = AnnotationFormValue->getAsUnsignedConstant();
361-
} else if (AnnotationName.compare(
362-
InstrProfCorrelator::NumCountersAttributeName) == 0) {
359+
} else if (AnnotationName ==
360+
InstrProfCorrelator::NumCountersAttributeName) {
363361
NumCounters = AnnotationFormValue->getAsUnsignedConstant();
364362
}
365363
}

llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,17 @@ getArgAccessQual(const Function &F, unsigned ArgIdx) {
171171
if (!ArgAttribute)
172172
return SPIRV::AccessQualifier::ReadWrite;
173173

174-
if (ArgAttribute->getString().compare("read_only") == 0)
174+
if (ArgAttribute->getString() == "read_only")
175175
return SPIRV::AccessQualifier::ReadOnly;
176-
if (ArgAttribute->getString().compare("write_only") == 0)
176+
if (ArgAttribute->getString() == "write_only")
177177
return SPIRV::AccessQualifier::WriteOnly;
178178
return SPIRV::AccessQualifier::ReadWrite;
179179
}
180180

181181
static std::vector<SPIRV::Decoration::Decoration>
182182
getKernelArgTypeQual(const Function &F, unsigned ArgIdx) {
183183
MDString *ArgAttribute = getOCLKernelArgTypeQual(F, ArgIdx);
184-
if (ArgAttribute && ArgAttribute->getString().compare("volatile") == 0)
184+
if (ArgAttribute && ArgAttribute->getString() == "volatile")
185185
return {SPIRV::Decoration::Volatile};
186186
return {};
187187
}

llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ bool X86AsmParser::ParseIntelNamedOperator(StringRef Name,
18021802
bool &ParseError, SMLoc &End) {
18031803
// A named operator should be either lower or upper case, but not a mix...
18041804
// except in MASM, which uses full case-insensitivity.
1805-
if (Name.compare(Name.lower()) && Name.compare(Name.upper()) &&
1805+
if (Name != Name.lower() && Name != Name.upper() &&
18061806
!getParser().isParsingMasm())
18071807
return false;
18081808
if (Name.equals_insensitive("not")) {

0 commit comments

Comments
 (0)