diff options
author | Owen Anderson <resistor@mac.com> | 2008-04-13 19:15:17 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-04-13 19:15:17 +0000 |
commit | 386ea355e730a1e92acf84e7a3f2ad95c3d6165b (patch) | |
tree | db0f8b4f971bfe783a270cd59caa66856dba6fa1 /lib | |
parent | 4a6da60787fcc66c521288fbd139cf8afdca5957 (diff) | |
download | external_llvm-386ea355e730a1e92acf84e7a3f2ad95c3d6165b.zip external_llvm-386ea355e730a1e92acf84e7a3f2ad95c3d6165b.tar.gz external_llvm-386ea355e730a1e92acf84e7a3f2ad95c3d6165b.tar.bz2 |
Replace calls of the form V1->setName(V2->getName()) with V1->takeName(V2),
which is significantly more efficient.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49614 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Scalar/LoopRotation.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Scalar/LoopUnroll.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/Scalar/TailDuplication.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Utils/CodeExtractor.cpp | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index a82b266..7aa169c 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -930,7 +930,7 @@ static bool LinkFunctionBody(Function *Dest, Function *Src, Function::arg_iterator DI = Dest->arg_begin(); for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end(); I != E; ++I, ++DI) { - DI->setName(I->getName()); // Copy the name information over... + DI->takeName(I); // Copy the name information over... // Add a mapping to our local map ValueMap[I] = DI; diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp index 51e2cd8..53473fd 100644 --- a/lib/Transforms/Scalar/LoopRotation.cpp +++ b/lib/Transforms/Scalar/LoopRotation.cpp @@ -226,7 +226,7 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) { // If this instruction is using a value from same basic block then // update it to use value from cloned instruction. Instruction *C = In->clone(); - C->setName(In->getName()); + C->takeName(In); OrigPreHeader->getInstList().push_back(C); for (unsigned opi = 0, e = In->getNumOperands(); opi != e; ++opi) { diff --git a/lib/Transforms/Scalar/LoopUnroll.cpp b/lib/Transforms/Scalar/LoopUnroll.cpp index 1962c14..a3c58f7 100644 --- a/lib/Transforms/Scalar/LoopUnroll.cpp +++ b/lib/Transforms/Scalar/LoopUnroll.cpp @@ -179,8 +179,8 @@ BasicBlock *LoopUnroll::FoldBlockIntoPredecessor(BasicBlock *BB) { BB->eraseFromParent(); // Inherit predecessor's name if it exists... - if (!OldName.empty() && !OnlyPred->hasName()) - OnlyPred->setName(OldName); + if (BB->hasName() && !OnlyPred->hasName()) + OnlyPred->takeName(BB); return OnlyPred; } diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index 929d113..5d802a6 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/lib/Transforms/Scalar/TailDuplication.cpp @@ -317,7 +317,7 @@ void TailDup::eliminateUnconditionalBranch(BranchInst *Branch) { // for (; BI != DestBlock->end(); ++BI) { Instruction *New = BI->clone(); - New->setName(BI->getName()); + New->takeName(BI); SourceBlock->getInstList().push_back(New); ValueMapping[BI] = New; } diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp index 5434119..b21683b 100644 --- a/lib/Transforms/Utils/CodeExtractor.cpp +++ b/lib/Transforms/Utils/CodeExtractor.cpp @@ -317,7 +317,7 @@ Function *CodeExtractor::constructFunction(const Values &inputs, if (!AggregateArgs) { AI = newFunction->arg_begin(); for (unsigned i = 0, e = inputs.size(); i != e; ++i, ++AI) - AI->setName(inputs[i]->getName()); + AI->takeName(inputs[i]); for (unsigned i = 0, e = outputs.size(); i != e; ++i, ++AI) AI->setName(outputs[i]->getName()+".out"); } |