[llvm] 326280d - [llvm][NFC] Refactor AutoUpgrade dbg case

Nathan Sidwell via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 20 09:10:08 PDT 2023


Author: Nathan Sidwell
Date: 2023-08-20T12:09:46-04:00
New Revision: 326280d9658fb21c97fb67c68a61835a66527c5e

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

LOG: [llvm][NFC] Refactor AutoUpgrade dbg case

Consume the dbg. prefix before looking further. Also merge the matched
path.

Differential Revision: https://reviews.llvm.org/D158341

Reviewed By: nikic

Added: 
    

Modified: 
    llvm/lib/IR/AutoUpgrade.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 7a6955f5a60614..5b6cd953ff593c 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -930,19 +930,16 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
     }
     break;
   }
-  case 'd': {
-    if (Name == "dbg.addr") {
-      rename(F);
-      NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::dbg_value);
-      return true;
-    }
-    if (Name == "dbg.value" && F->arg_size() == 4) {
-      rename(F);
-      NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::dbg_value);
-      return true;
+  case 'd':
+    if (Name.consume_front("dbg.")) {
+      if (Name == "addr" || (Name == "value" && F->arg_size() == 4)) {
+        rename(F);
+        NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::dbg_value);
+        return true;
+      }
+      break; // No other 'dbg.*'.
     }
     break;
-  }
   case 'e':
     if (Name.consume_front("experimental.vector.")) {
       Intrinsic::ID ID = StringSwitch<Intrinsic::ID>(Name)


        


More information about the llvm-commits mailing list