Use StringRef which performs the "early exit" when compared against a constant
authorBill Wendling <isanbard@gmail.com>
Fri, 10 Sep 2010 20:42:26 +0000 (20:42 +0000)
committerBill Wendling <isanbard@gmail.com>
Fri, 10 Sep 2010 20:42:26 +0000 (20:42 +0000)
string.

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

lib/VMCore/AutoUpgrade.cpp

index 2eeb35414a0f4868c7a374e2b34324be619747c6..9330e141c34120f4cd45e4c4a68f6ca6dc734d3b 100644 (file)
@@ -366,12 +366,7 @@ bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) {
 }
 
 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.
   if (Name == ".llvm.eh.catch.all.value") {