diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2018-08-09 22:20:44 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2018-08-09 22:20:44 +0000 |
| commit | c6944f795d846ae55f8375dd0f8f8ef2045d4cfb (patch) | |
| tree | 3cf71c4520086ee23bfaa13682383a4742e64ad6 /llvm/lib/Transforms | |
| parent | 94abc57e3751f591fdb0655419eb129252d1f9c7 (diff) | |
| download | bcm5719-llvm-c6944f795d846ae55f8375dd0f8f8ef2045d4cfb.tar.gz bcm5719-llvm-c6944f795d846ae55f8375dd0f8f8ef2045d4cfb.zip | |
[InstSimplify] move minnum/maxnum with Inf folds from instcombine
llvm-svn: 339396
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index dcd080e3305..310b87e931c 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -1133,37 +1133,6 @@ static Value *simplifyX86vpcom(const IntrinsicInst &II, return nullptr; } -static Value *simplifyMinnumMaxnum(const IntrinsicInst &II) { - Value *Arg0 = II.getArgOperand(0); - Value *Arg1 = II.getArgOperand(1); - - const auto *C1 = dyn_cast<ConstantFP>(Arg1); - - // fmin(x, nan) -> x - if (C1 && C1->isNaN()) - return Arg0; - - if (II.getIntrinsicID() == Intrinsic::minnum) { - // TODO: fmin(nnan x, inf) -> x - // TODO: fmin(nnan ninf x, flt_max) -> x - if (C1 && C1->isInfinity()) { - // fmin(x, -inf) -> -inf - if (C1->isNegative()) - return Arg1; - } - } else { - assert(II.getIntrinsicID() == Intrinsic::maxnum); - // TODO: fmax(nnan x, -inf) -> x - // TODO: fmax(nnan ninf x, -flt_max) -> x - if (C1 && C1->isInfinity()) { - // fmax(x, inf) -> inf - if (!C1->isNegative()) - return Arg1; - } - } - return nullptr; -} - static bool maskIsAllOneOrUndef(Value *Mask) { auto *ConstMask = dyn_cast<Constant>(Mask); if (!ConstMask) @@ -2000,10 +1969,6 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { return II; } - // FIXME: Simplifications should be in instsimplify. - if (Value *V = simplifyMinnumMaxnum(*II)) - return replaceInstUsesWith(*II, V); - Value *X, *Y; if (match(Arg0, m_FNeg(m_Value(X))) && match(Arg1, m_FNeg(m_Value(Y))) && (Arg0->hasOneUse() || Arg1->hasOneUse())) { |

