Skip to content

Commit fdea1b6

Browse files
[Utils] Use StringRef::starts_with (NFC) (#138379)
1 parent edb690d commit fdea1b6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Transforms/Utils/IRNormalizer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,16 +367,16 @@ void IRNormalizer::foldInstructionName(Instruction *I) const {
367367
}
368368

369369
// Don't fold if it is an output instruction or has no op prefix.
370-
if (isOutput(I) || I->getName().substr(0, 2) != "op")
370+
if (isOutput(I) || !I->getName().starts_with("op"))
371371
return;
372372

373373
// Instruction operands.
374374
SmallVector<SmallString<64>, 4> Operands;
375375

376376
for (auto &Op : I->operands()) {
377377
if (const auto *I = dyn_cast<Instruction>(Op)) {
378-
bool HasNormalName = I->getName().substr(0, 2) == "op" ||
379-
I->getName().substr(0, 2) == "vl";
378+
bool HasNormalName =
379+
I->getName().starts_with("op") || I->getName().starts_with("vl");
380380

381381
Operands.push_back(HasNormalName ? I->getName().substr(0, 7)
382382
: I->getName());

0 commit comments

Comments
 (0)