Call SimplifyFDivInst() in InstCombiner::visitFDiv().

llvm-svn: 124535
This commit is contained in:
Frits van Bommel 2011-01-29 17:50:27 +00:00
parent 92dc04df67
commit b1b70f2a44
2 changed files with 10 additions and 0 deletions

View File

@ -118,6 +118,7 @@ public:
Instruction *commonIDivTransforms(BinaryOperator &I);
Instruction *visitUDiv(BinaryOperator &I);
Instruction *visitSDiv(BinaryOperator &I);
Instruction *visitFDiv(BinaryOperator &I);
Value *FoldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS);
Value *FoldAndOfFCmps(FCmpInst *LHS, FCmpInst *RHS);
Instruction *visitAnd(BinaryOperator &I);

View File

@ -473,6 +473,15 @@ Instruction *InstCombiner::visitSDiv(BinaryOperator &I) {
return 0;
}
Instruction *InstCombiner::visitFDiv(BinaryOperator &I) {
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
if (Value *V = SimplifyFDivInst(Op0, Op1, TD))
return ReplaceInstUsesWith(I, V);
return 0;
}
/// This function implements the transforms on rem instructions that work
/// regardless of the kind of rem instruction it is (urem, srem, or frem). It
/// is used by the visitors to those instructions.