[llvm] d4a6b05 - AutoUpgrade: Use consume_front

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 14:29:25 PDT 2023


Author: Matt Arsenault
Date: 2023-07-26T17:29:19-04:00
New Revision: d4a6b056819e0eec94bf43900680759c8dec92d0

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

LOG: AutoUpgrade: Use consume_front

Added: 
    

Modified: 
    llvm/lib/IR/AutoUpgrade.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 71b5722925a1ed..4182b4af2d9ce6 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -897,21 +897,20 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
         Name == "arm.cde.vcx3qa.predicated.v2i64.v4i1")
       return true;
 
-    if (Name.startswith("amdgcn."))
-      Name = Name.substr(7); // Strip off "amdgcn."
-
-    if (Name == "alignbit") {
-      // Target specific intrinsic became redundant
-      NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::fshr,
-                                        {F->getReturnType()});
-      return true;
-    }
+    if (Name.consume_front("amdgcn.")) {
+      if (Name == "alignbit") {
+        // Target specific intrinsic became redundant
+        NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::fshr,
+                                          {F->getReturnType()});
+        return true;
+      }
 
-    if (Name.startswith("atomic.inc") || Name.startswith("atomic.dec")) {
-      // This was replaced with atomicrmw uinc_wrap and udec_wrap, so there's no
-      // new declaration.
-      NewFn = nullptr;
-      return true;
+      if (Name.startswith("atomic.inc") || Name.startswith("atomic.dec")) {
+        // This was replaced with atomicrmw uinc_wrap and udec_wrap, so there's no
+        // new declaration.
+        NewFn = nullptr;
+        return true;
+      }
     }
 
     break;


        


More information about the llvm-commits mailing list