[llvm-commits] [llvm] r113615 - /llvm/trunk/lib/VMCore/AutoUpgrade.cpp

Bill Wendling isanbard at gmail.com
Fri Sep 10 13:42:26 PDT 2010


Author: void
Date: Fri Sep 10 15:42:26 2010
New Revision: 113615

URL: http://llvm.org/viewvc/llvm-project?rev=113615&view=rev
Log:
Use StringRef which performs the "early exit" when compared against a constant
string.

Modified:
    llvm/trunk/lib/VMCore/AutoUpgrade.cpp

Modified: llvm/trunk/lib/VMCore/AutoUpgrade.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AutoUpgrade.cpp?rev=113615&r1=113614&r2=113615&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AutoUpgrade.cpp (original)
+++ llvm/trunk/lib/VMCore/AutoUpgrade.cpp Fri Sep 10 15:42:26 2010
@@ -366,12 +366,7 @@
 }
 
 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") {





More information about the llvm-commits mailing list