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 | 6e0123b17f519377e277281cf9e7a70c1b1dbb96 (patch) | |
| tree | 3ab0896ce754c22324c750adef5751294b040ffb /llvm/lib/Transforms/Scalar/Reassociate.cpp | |
| parent | 8d4c36bb4086e34efadb812a7a87de1e07ff5d98 (diff) | |
| download | bcm5719-llvm-6e0123b17f519377e277281cf9e7a70c1b1dbb96.tar.gz bcm5719-llvm-6e0123b17f519377e277281cf9e7a70c1b1dbb96.zip | |
Simplify code by using value::takename
llvm-svn: 34176
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Reassociate.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index 40f2ece255e..2193777e250 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/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; |

