summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-11 01:08:35 +0000
committerChris Lattner <sabre@nondot.org>2007-02-11 01:08:35 +0000
commit8d4c36bb4086e34efadb812a7a87de1e07ff5d98 (patch)
tree7dccb9ab6e438fbd691c1c1b45fa91f00e14391f /llvm/lib/Transforms/IPO/GlobalOpt.cpp
parentcba18e3a0127b621085af39f9e7f13fed07f1c7e (diff)
downloadbcm5719-llvm-8d4c36bb4086e34efadb812a7a87de1e07ff5d98.tar.gz
bcm5719-llvm-8d4c36bb4086e34efadb812a7a87de1e07ff5d98.zip
simplify name juggling through the use of Value::takeName.
llvm-svn: 34175
Diffstat (limited to 'llvm/lib/Transforms/IPO/GlobalOpt.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/GlobalOpt.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
index 5be5ace315f..f5b12712f3a 100644
--- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -1189,14 +1189,13 @@ static void ShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) {
} else if (!UI->use_empty()) {
// Change the load into a load of bool then a select.
LoadInst *LI = cast<LoadInst>(UI);
-
- std::string Name = LI->getName(); LI->setName("");
- LoadInst *NLI = new LoadInst(NewGV, Name+".b", LI);
+ LoadInst *NLI = new LoadInst(NewGV, LI->getName()+".b", LI);
Value *NSI;
if (IsOneZero)
- NSI = new ZExtInst(NLI, LI->getType(), Name, LI);
+ NSI = new ZExtInst(NLI, LI->getType(), "", LI);
else
- NSI = new SelectInst(NLI, OtherVal, InitVal, Name, LI);
+ NSI = new SelectInst(NLI, OtherVal, InitVal, "", LI);
+ NSI->takeName(LI);
LI->replaceAllUsesWith(NSI);
}
UI->eraseFromParent();
@@ -1519,10 +1518,9 @@ static GlobalVariable *InstallGlobalCtors(GlobalVariable *GCL,
// Create the new global and insert it next to the existing list.
GlobalVariable *NGV = new GlobalVariable(CA->getType(), GCL->isConstant(),
- GCL->getLinkage(), CA,
- GCL->getName());
- GCL->setName("");
+ GCL->getLinkage(), CA);
GCL->getParent()->getGlobalList().insert(GCL, NGV);
+ NGV->takeName(GCL);
// Nuke the old list, replacing any uses with the new one.
if (!GCL->use_empty()) {
OpenPOWER on IntegriCloud