simplify name juggling through the use of Value::takeName.
llvm-svn: 34175
diff --git a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
index b689de7..aeb4173 100644
--- a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -164,8 +164,8 @@
CastInst::createIntegerCast(Source, Type::Int32Ty, false/*ZExt*/,
"MallocAmtCast", I);
- std::string Name(I->getName()); I->setName("");
- MallocInst *MI = new MallocInst(Type::Int8Ty, Source, Name, I);
+ MallocInst *MI = new MallocInst(Type::Int8Ty, Source, "", I);
+ MI->takeName(I);
I->replaceAllUsesWith(MI);
// If the old instruction was an invoke, add an unconditional branch