diff options
author | Nathan Sidwell <nathan@acm.org> | 2023-12-02 11:57:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-02 11:57:41 -0500 |
commit | d04a4a06abd4c415d7e433fef1553cfdcddea858 (patch) | |
tree | 1ab269626c4f25f5eeb5d55ffee2ef817c4f9816 /llvm/lib/IR | |
parent | 1fa35f0b5dc2f3427fbade0eaaca6e2d8c32caef (diff) | |
download | llvm-d04a4a06abd4c415d7e433fef1553cfdcddea858.zip llvm-d04a4a06abd4c415d7e433fef1553cfdcddea858.tar.gz llvm-d04a4a06abd4c415d7e433fef1553cfdcddea858.tar.bz2 |
[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.
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r-- | llvm/lib/IR/AutoUpgrade.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 9d546d3..7a40f24 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -704,11 +704,11 @@ static Intrinsic::ID ShouldUpgradeNVPTXBF16Intrinsic(StringRef Name) { static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) { assert(F && "Illegal to upgrade a non-existent Function."); - // Quickly eliminate it, if it's not a candidate. StringRef Name = F->getName(); - if (Name.size() <= 7 || !Name.starts_with("llvm.")) + + // Quickly eliminate it, if it's not a candidate. + if (!Name.consume_front("llvm.") || Name.empty()) return false; - Name = Name.substr(5); // Strip off "llvm." switch (Name[0]) { default: break; |