Early exit with simple checks.
authorBill Wendling <isanbard@gmail.com>
Fri, 10 Sep 2010 19:06:58 +0000 (19:06 +0000)
committerBill Wendling <isanbard@gmail.com>
Fri, 10 Sep 2010 19:06:58 +0000 (19:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113603 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AutoUpgrade.cpp

index 3908e8aed68cb2e7284e15538793ccb5505ac9e2..2eeb35414a0f4868c7a374e2b34324be619747c6 100644 (file)
@@ -368,9 +368,12 @@ bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) {
 bool llvm::UpgradeGlobalVariable(GlobalVariable *GV) {
   const std::string &Name = GV->getName();
 
-  // We are only upgrading one symbol here. If we upgrade more, we will want to
-  // perform some sort of short-circuiting like in the
-  // "UpgradeIntrinsicFunction1" function.
+  // Early exit with simple tests.
+  if (Name.length() != 24 || Name[0] != '.' || Name[1] != 'l' ||
+      Name[3] != 'l' || Name[4] != 'v' || Name[5] != 'm' || Name[6] != '.')
+    return false;
+
+  // We are only upgrading one symbol here.
   if (Name == ".llvm.eh.catch.all.value") {
     GV->setName("llvm.eh.catch.all.value");
     return true;