[llvm] r274862 - Move setName after accessing Name
Eric Liu via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 8 09:09:51 PDT 2016
Author: ioeric
Date: Fri Jul 8 11:09:51 2016
New Revision: 274862
URL: http://llvm.org/viewvc/llvm-project?rev=274862&view=rev
Log:
Move setName after accessing Name
Modified:
llvm/trunk/lib/IR/AutoUpgrade.cpp
Modified: llvm/trunk/lib/IR/AutoUpgrade.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AutoUpgrade.cpp?rev=274862&r1=274861&r2=274862&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AutoUpgrade.cpp (original)
+++ llvm/trunk/lib/IR/AutoUpgrade.cpp Fri Jul 8 11:09:51 2016
@@ -67,10 +67,7 @@ static bool UpgradeIntrinsicFunction1(Fu
assert(F && "Illegal to upgrade a non-existent Function.");
// Quickly eliminate it, if it's not a candidate.
- // Make a copy of the name so that we don't need to worry about the life-time
- // of StringRef.
- std::string NameStr = F->getName().str();
- StringRef Name = NameStr;
+ StringRef Name = F->getName();
if (Name.size() <= 8 || !Name.startswith("llvm."))
return false;
Name = Name.substr(5); // Strip off "llvm."
@@ -348,7 +345,6 @@ static bool UpgradeIntrinsicFunction1(Fu
if (IsX86 && (Name.startswith("avx512.mask.pslli.") ||
Name.startswith("avx512.mask.psrai.") ||
Name.startswith("avx512.mask.psrli."))) {
- F->setName("llvm.x86." + Name + ".old");
Intrinsic::ID ShiftID;
if (Name.slice(12, 16) == "psll")
ShiftID = Name[18] == 'd' ? Intrinsic::x86_avx512_mask_psll_di_512
@@ -359,6 +355,7 @@ static bool UpgradeIntrinsicFunction1(Fu
else
ShiftID = Name[18] == 'd' ? Intrinsic::x86_avx512_mask_psrl_di_512
: Intrinsic::x86_avx512_mask_psrl_qi_512;
+ F->setName("llvm.x86." + Name + ".old");
NewFn = Intrinsic::getDeclaration(F->getParent(), ShiftID);
return true;
}
More information about the llvm-commits
mailing list