forked from OSchip/llvm-project
Replace calls of the form V1->setName(V2->getName()) with V1->takeName(V2),
which is significantly more efficient. llvm-svn: 49614
This commit is contained in:
parent
861a226586
commit
1f6fbc4bc3
|
@ -930,7 +930,7 @@ static bool LinkFunctionBody(Function *Dest, Function *Src,
|
||||||
Function::arg_iterator DI = Dest->arg_begin();
|
Function::arg_iterator DI = Dest->arg_begin();
|
||||||
for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end();
|
for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end();
|
||||||
I != E; ++I, ++DI) {
|
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
|
// Add a mapping to our local map
|
||||||
ValueMap[I] = DI;
|
ValueMap[I] = DI;
|
||||||
|
|
|
@ -226,7 +226,7 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
|
||||||
// If this instruction is using a value from same basic block then
|
// If this instruction is using a value from same basic block then
|
||||||
// update it to use value from cloned instruction.
|
// update it to use value from cloned instruction.
|
||||||
Instruction *C = In->clone();
|
Instruction *C = In->clone();
|
||||||
C->setName(In->getName());
|
C->takeName(In);
|
||||||
OrigPreHeader->getInstList().push_back(C);
|
OrigPreHeader->getInstList().push_back(C);
|
||||||
|
|
||||||
for (unsigned opi = 0, e = In->getNumOperands(); opi != e; ++opi) {
|
for (unsigned opi = 0, e = In->getNumOperands(); opi != e; ++opi) {
|
||||||
|
|
|
@ -179,8 +179,8 @@ BasicBlock *LoopUnroll::FoldBlockIntoPredecessor(BasicBlock *BB) {
|
||||||
BB->eraseFromParent();
|
BB->eraseFromParent();
|
||||||
|
|
||||||
// Inherit predecessor's name if it exists...
|
// Inherit predecessor's name if it exists...
|
||||||
if (!OldName.empty() && !OnlyPred->hasName())
|
if (BB->hasName() && !OnlyPred->hasName())
|
||||||
OnlyPred->setName(OldName);
|
OnlyPred->takeName(BB);
|
||||||
|
|
||||||
return OnlyPred;
|
return OnlyPred;
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,7 +317,7 @@ void TailDup::eliminateUnconditionalBranch(BranchInst *Branch) {
|
||||||
//
|
//
|
||||||
for (; BI != DestBlock->end(); ++BI) {
|
for (; BI != DestBlock->end(); ++BI) {
|
||||||
Instruction *New = BI->clone();
|
Instruction *New = BI->clone();
|
||||||
New->setName(BI->getName());
|
New->takeName(BI);
|
||||||
SourceBlock->getInstList().push_back(New);
|
SourceBlock->getInstList().push_back(New);
|
||||||
ValueMapping[BI] = New;
|
ValueMapping[BI] = New;
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,7 +317,7 @@ Function *CodeExtractor::constructFunction(const Values &inputs,
|
||||||
if (!AggregateArgs) {
|
if (!AggregateArgs) {
|
||||||
AI = newFunction->arg_begin();
|
AI = newFunction->arg_begin();
|
||||||
for (unsigned i = 0, e = inputs.size(); i != e; ++i, ++AI)
|
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)
|
for (unsigned i = 0, e = outputs.size(); i != e; ++i, ++AI)
|
||||||
AI->setName(outputs[i]->getName()+".out");
|
AI->setName(outputs[i]->getName()+".out");
|
||||||
}
|
}
|
||||||
|
|
|
@ -657,7 +657,7 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test,
|
||||||
for (Function::arg_iterator
|
for (Function::arg_iterator
|
||||||
I = newMain->arg_begin(), E = newMain->arg_end(),
|
I = newMain->arg_begin(), E = newMain->arg_end(),
|
||||||
OI = oldMain->arg_begin(); I != E; ++I, ++OI) {
|
OI = oldMain->arg_begin(); I != E; ++I, ++OI) {
|
||||||
I->setName(OI->getName()); // Copy argument names from oldMain
|
I->takeName(OI); // Copy argument names from oldMain
|
||||||
args.push_back(I);
|
args.push_back(I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue