[llvm] [llvm] Use StringRef::contains (NFC) (PR #165397)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 28 07:11:24 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
Identified with readability-container-contains
---
Full diff: https://github.com/llvm/llvm-project/pull/165397.diff
3 Files Affected:
- (modified) llvm/include/llvm/IR/Mangler.h (+1-2)
- (modified) llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp (+1-1)
- (modified) llvm/lib/Target/SystemZ/SystemZISelLowering.cpp (+1-2)
``````````diff
diff --git a/llvm/include/llvm/IR/Mangler.h b/llvm/include/llvm/IR/Mangler.h
index 232101a8926b7..4d387ba73127d 100644
--- a/llvm/include/llvm/IR/Mangler.h
+++ b/llvm/include/llvm/IR/Mangler.h
@@ -80,8 +80,7 @@ getArm64ECDemangledFunctionName(StringRef Name);
/// Check if an ARM64EC function name is mangled.
bool inline isArm64ECMangledFunctionName(StringRef Name) {
- return Name[0] == '#' ||
- (Name[0] == '?' && Name.find("@$$h") != StringRef::npos);
+ return Name[0] == '#' || (Name[0] == '?' && Name.contains("@$$h"));
}
} // End llvm namespace
diff --git a/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp b/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
index 4029e143ae2a4..729c077884f3a 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
@@ -493,7 +493,7 @@ NVPTXTTIImpl::getInstructionCost(const User *U,
// predicate ("@").
return !AsmInst.empty() &&
(AsmInst[0] == '@' || isAlpha(AsmInst[0]) ||
- AsmInst.find(".pragma") != StringRef::npos);
+ AsmInst.contains(".pragma"));
});
return InstCount * TargetTransformInfo::TCC_Basic;
}
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index 3da720f54e6ab..58109acc92015 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -8973,8 +8973,7 @@ SystemZTargetLowering::getJumpConditionMergingParams(Instruction::BinaryOps Opc,
if (const auto *CB = dyn_cast<CallBase>(RHSVal)) {
if (CB->isInlineAsm()) {
const InlineAsm *IA = cast<InlineAsm>(CB->getCalledOperand());
- return IA &&
- IA->getConstraintString().find("{@cc}") != std::string::npos;
+ return IA && IA->getConstraintString().contains("{@cc}");
}
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/165397
More information about the llvm-commits
mailing list