[llvm-commits] [llvm] r113603 - /llvm/trunk/lib/VMCore/AutoUpgrade.cpp
Chris Lattner
clattner at apple.com
Fri Sep 10 13:27:27 PDT 2010
On Sep 10, 2010, at 12:06 PM, Bill Wendling wrote:
> Author: void
> Date: Fri Sep 10 14:06:58 2010
> New Revision: 113603
>
> URL: http://llvm.org/viewvc/llvm-project?rev=113603&view=rev
> Log:
> Early exit with simple checks.
Hi Bill, please capture Name as a StringRef instead of std::string.
The early exit isn't needed, stringref does it for you in == with a constant string.
-Chris
>
> 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=113603&r1=113602&r2=113603&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/AutoUpgrade.cpp (original)
> +++ llvm/trunk/lib/VMCore/AutoUpgrade.cpp Fri Sep 10 14:06:58 2010
> @@ -368,9 +368,12 @@
> 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;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list