diff options
author | Chris Lattner <sabre@nondot.org> | 2007-02-11 01:23:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-02-11 01:23:03 +0000 |
commit | 6934a04a8c15e9971cd1ea4d5c8df2d7afdd5be5 (patch) | |
tree | 23823b269e47b7026c27e2da4eb05b062db0b123 /lib/Transforms/Scalar/Reassociate.cpp | |
parent | 046800a7125cd497613efc0e1ea15cb595666585 (diff) |
Simplify code by using value::takename
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34176 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r-- | lib/Transforms/Scalar/Reassociate.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index 40f2ece255..2193777e25 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -189,9 +189,8 @@ static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode) { static Instruction *LowerNegateToMultiply(Instruction *Neg) { Constant *Cst = ConstantInt::getAllOnesValue(Neg->getType()); - std::string NegName = Neg->getName(); Neg->setName(""); - Instruction *Res = BinaryOperator::createMul(Neg->getOperand(1), Cst, NegName, - Neg); + Instruction *Res = BinaryOperator::createMul(Neg->getOperand(1), Cst, "",Neg); + Res->takeName(Neg); Neg->replaceAllUsesWith(Res); Neg->eraseFromParent(); return Res; @@ -405,11 +404,10 @@ static Instruction *BreakUpSubtract(Instruction *Sub) { // Calculate the negative value of Operand 1 of the sub instruction... // and set it as the RHS of the add instruction we just made... // - std::string Name = Sub->getName(); - Sub->setName(""); Value *NegVal = NegateValue(Sub->getOperand(1), Sub); Instruction *New = - BinaryOperator::createAdd(Sub->getOperand(0), NegVal, Name, Sub); + BinaryOperator::createAdd(Sub->getOperand(0), NegVal, "", Sub); + New->takeName(Sub); // Everyone now refers to the add instruction. Sub->replaceAllUsesWith(New); @@ -432,9 +430,9 @@ static Instruction *ConvertShiftToMul(Instruction *Shl) { Constant *MulCst = ConstantInt::get(Shl->getType(), 1); MulCst = ConstantExpr::getShl(MulCst, cast<Constant>(Shl->getOperand(1))); - std::string Name = Shl->getName(); Shl->setName(""); Instruction *Mul = BinaryOperator::createMul(Shl->getOperand(0), MulCst, - Name, Shl); + "", Shl); + Mul->takeName(Shl); Shl->replaceAllUsesWith(Mul); Shl->eraseFromParent(); return Mul; |