[llvm] d25ef09 - [AutoUpgrade] Fix length check for intrinsic upgrade

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 01:53:13 PDT 2022


Author: Nikita Popov
Date: 2022-10-21T10:53:06+02:00
New Revision: d25ef09466e4e4ca807e85360812cf9d139c4249

URL: https://github.com/llvm/llvm-project/commit/d25ef09466e4e4ca807e85360812cf9d139c4249
DIFF: https://github.com/llvm/llvm-project/commit/d25ef09466e4e4ca807e85360812cf9d139c4249.diff

LOG: [AutoUpgrade] Fix length check for intrinsic upgrade

The shortest intrinsics that can be upgraded via remangling have
8 characters (like "llvm.abs"). Make sure these go through the
upgrade code.

I think that currently this change is not observable from in-tree
callers of UpgradeIntrinsicFunction(), because callers do
redundant remangling checks. However, this issue shows up in
existing tests if those checks are removed (which I will do in
followup changes).

Added: 
    

Modified: 
    llvm/lib/IR/AutoUpgrade.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index ebc362a4f8a09..5ecf34419c748 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -583,7 +583,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
 
   // Quickly eliminate it, if it's not a candidate.
   StringRef Name = F->getName();
-  if (Name.size() <= 8 || !Name.startswith("llvm."))
+  if (Name.size() <= 7 || !Name.startswith("llvm."))
     return false;
   Name = Name.substr(5); // Strip off "llvm."
 


        


More information about the llvm-commits mailing list