[llvm] fdea1b6 - [Utils] Use StringRef::starts_with (NFC) (#138379)
via llvm-commits
llvm-commits at lists.llvm.org
Sat May 3 07:04:14 PDT 2025
Author: Kazu Hirata
Date: 2025-05-03T07:04:10-07:00
New Revision: fdea1b6504770462138a92c9c9aa6b669f7f4217
URL: https://github.com/llvm/llvm-project/commit/fdea1b6504770462138a92c9c9aa6b669f7f4217
DIFF: https://github.com/llvm/llvm-project/commit/fdea1b6504770462138a92c9c9aa6b669f7f4217.diff
LOG: [Utils] Use StringRef::starts_with (NFC) (#138379)
Added:
Modified:
llvm/lib/Transforms/Utils/IRNormalizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/IRNormalizer.cpp b/llvm/lib/Transforms/Utils/IRNormalizer.cpp
index 75e775086493a..fd355ff9294cc 100644
--- a/llvm/lib/Transforms/Utils/IRNormalizer.cpp
+++ b/llvm/lib/Transforms/Utils/IRNormalizer.cpp
@@ -367,7 +367,7 @@ void IRNormalizer::foldInstructionName(Instruction *I) const {
}
// Don't fold if it is an output instruction or has no op prefix.
- if (isOutput(I) || I->getName().substr(0, 2) != "op")
+ if (isOutput(I) || !I->getName().starts_with("op"))
return;
// Instruction operands.
@@ -375,8 +375,8 @@ void IRNormalizer::foldInstructionName(Instruction *I) const {
for (auto &Op : I->operands()) {
if (const auto *I = dyn_cast<Instruction>(Op)) {
- bool HasNormalName = I->getName().substr(0, 2) == "op" ||
- I->getName().substr(0, 2) == "vl";
+ bool HasNormalName =
+ I->getName().starts_with("op") || I->getName().starts_with("vl");
Operands.push_back(HasNormalName ? I->getName().substr(0, 7)
: I->getName());
More information about the llvm-commits
mailing list