return Changed ? &I : nullptr;
}
-static Instruction *foldFPSignBitOps(BinaryOperator &I,
- InstCombiner::BuilderTy &Builder) {
- Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
+static Instruction *foldFPSignBitOps(BinaryOperator &I) {
BinaryOperator::BinaryOps Opcode = I.getOpcode();
+ assert((Opcode == Instruction::FMul || Opcode == Instruction::FDiv) &&
+ "Expected fmul or fdiv");
+
+ Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
Value *X, *Y;
// -X * -Y --> X * Y
if (Value *FoldedMul = foldMulSelectToNegate(I, Builder))
return replaceInstUsesWith(I, FoldedMul);
- if (Instruction *R = foldFPSignBitOps(I, Builder))
+ if (Instruction *R = foldFPSignBitOps(I))
return R;
// X * -1.0 --> -X
if (Instruction *R = foldFDivConstantDividend(I))
return R;
- if (Instruction *R = foldFPSignBitOps(I, Builder))
+ if (Instruction *R = foldFPSignBitOps(I))
return R;
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);