diff options
author | Frits van Bommel <fvbommel@gmail.com> | 2011-01-29 17:50:27 +0000 |
---|---|---|
committer | Frits van Bommel <fvbommel@gmail.com> | 2011-01-29 17:50:27 +0000 |
commit | 2a55951d08d130845d111c87bc0fc87c6ad18b8f (patch) | |
tree | b89b8d2eba7e80a5c327e71c4a2521ddf76ced30 /llvm/lib/Transforms/InstCombine | |
parent | c2549661af0b4f5b4e9564f9e90e5ddcf7c68d2d (diff) | |
download | bcm5719-llvm-2a55951d08d130845d111c87bc0fc87c6ad18b8f.tar.gz bcm5719-llvm-2a55951d08d130845d111c87bc0fc87c6ad18b8f.zip |
Call SimplifyFDivInst() in InstCombiner::visitFDiv().
llvm-svn: 124535
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombine.h | 1 | ||||
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombine.h b/llvm/lib/Transforms/InstCombine/InstCombine.h index ef49790d148..450e7f0a398 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombine.h +++ b/llvm/lib/Transforms/InstCombine/InstCombine.h @@ -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); diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index 32b2a0ac0ee..035ee721bfd 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -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. |