Browse Source

Use StringRef which performs the "early exit" when compared against a constant
string.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113615 91177308-0d34-0410-b5e6-96231b3b80d8

Bill Wendling 15 years ago
parent
commit
f9e49e86ee
1 changed files with 1 additions and 6 deletions
  1. 1 6
      lib/VMCore/AutoUpgrade.cpp

+ 1 - 6
lib/VMCore/AutoUpgrade.cpp

@@ -366,12 +366,7 @@ bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) {
 }
 }
 
 
 bool llvm::UpgradeGlobalVariable(GlobalVariable *GV) {
 bool llvm::UpgradeGlobalVariable(GlobalVariable *GV) {
-  const std::string &Name = GV->getName();
-
-  // 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;
+  StringRef Name(GV->getName());
 
 
   // We are only upgrading one symbol here.
   // We are only upgrading one symbol here.
   if (Name == ".llvm.eh.catch.all.value") {
   if (Name == ".llvm.eh.catch.all.value") {