void
Substitution::addDoubleNeg(BinaryOperator *bo) {
BinaryOperator *op, *op2 = NULL;
UnaryOperator *op3, *op4;
if
(bo->getOpcode() == Instruction::Add) {
op = BinaryOperator::CreateNeg(bo->getOperand(0),
""
, bo);
op2 = BinaryOperator::CreateNeg(bo->getOperand(1),
""
, bo);
op = BinaryOperator::Create(Instruction::Add, op, op2,
""
, bo);
op = BinaryOperator::CreateNeg(op,
""
, bo);
bo->replaceAllUsesWith(op);
}
else
{
op3 = UnaryOperator::CreateFNeg(bo->getOperand(0),
""
, bo);
op4 = UnaryOperator::CreateFNeg(bo->getOperand(1),
""
, bo);
op = BinaryOperator::Create(Instruction::FAdd, op3, op4,
""
, bo);
op3 = UnaryOperator::CreateFNeg(op,
""
, bo);
bo->replaceAllUsesWith(op3);
}
}