diff options
| author | Cameron McInally <cameron.mcinally@nyu.edu> | 2019-05-10 20:01:04 +0000 | 
|---|---|---|
| committer | Cameron McInally <cameron.mcinally@nyu.edu> | 2019-05-10 20:01:04 +0000 | 
| commit | e75412ab4748201328138078c27f1c9bad4b8b79 (patch) | |
| tree | 6edaf6c7d630a4cecaeae61c05f4eb753ab28a5c /llvm/lib | |
| parent | e99486dc111ab923342da9eeaa5714fa97276ebe (diff) | |
| download | bcm5719-llvm-e75412ab4748201328138078c27f1c9bad4b8b79.tar.gz bcm5719-llvm-e75412ab4748201328138078c27f1c9bad4b8b79.zip  | |
Add InstCombine::visitFNeg(...)
Differential Revision: https://reviews.llvm.org/D61784
llvm-svn: 360461
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp | 9 | ||||
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineInternal.h | 1 | 
2 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp index a2313809d28..5f5a94e4b25 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp @@ -1821,6 +1821,15 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {    return Changed ? &I : nullptr;  } +Instruction *InstCombiner::visitFNeg(UnaryOperator &I) { +  if (Value *V = SimplifyFNegInst(I.getOperand(0), I.getFastMathFlags(), +                                  SQ.getWithInstruction(&I))) +    return replaceInstUsesWith(I, V); + +  return nullptr; +} + +  Instruction *InstCombiner::visitFSub(BinaryOperator &I) {    if (Value *V = SimplifyFSubInst(I.getOperand(0), I.getOperand(1),                                    I.getFastMathFlags(), diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h index 27b8ea81ec0..c34a71a2251 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h +++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h @@ -347,6 +347,7 @@ public:    //     I          - Change was made, I is still valid, I may be dead though    //   otherwise    - Change was made, replace I with returned instruction    // +  Instruction *visitFNeg(UnaryOperator &I);    Instruction *visitAdd(BinaryOperator &I);    Instruction *visitFAdd(BinaryOperator &I);    Value *OptimizePointerDifference(Value *LHS, Value *RHS, Type *Ty);  | 

