Skip to content

Commit d04a4a0

Browse files
authored
[llvm] Adjust Autoupdater's llvm prefix detection (#74142)
Use consume_front to swallow the 'llvm.' prefix, and 'empty' to check there's at least one character left.
1 parent 1fa35f0 commit d04a4a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,11 +704,11 @@ static Intrinsic::ID ShouldUpgradeNVPTXBF16Intrinsic(StringRef Name) {
704704
static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
705705
assert(F && "Illegal to upgrade a non-existent Function.");
706706

707-
// Quickly eliminate it, if it's not a candidate.
708707
StringRef Name = F->getName();
709-
if (Name.size() <= 7 || !Name.starts_with("llvm."))
708+
709+
// Quickly eliminate it, if it's not a candidate.
710+
if (!Name.consume_front("llvm.") || Name.empty())
710711
return false;
711-
Name = Name.substr(5); // Strip off "llvm."
712712

713713
switch (Name[0]) {
714714
default: break;

0 commit comments

Comments
 (0)