mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
Simplify code by using value::takename
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34176 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user