diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-09-02 18:10:29 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-09-02 18:10:29 +0000 |
commit | bc6da4e40f6b389c4675812350bf096790591e8c (patch) | |
tree | e159f8b2d20f923ed430f13db6e1c5c40c99db43 /llvm/lib/Transforms/InstCombine | |
parent | 64fc5daf42711295b8c6747f38296e9ff6303a6a (diff) | |
download | bcm5719-llvm-bc6da4e40f6b389c4675812350bf096790591e8c.tar.gz bcm5719-llvm-bc6da4e40f6b389c4675812350bf096790591e8c.zip |
[InstCombine] replace unnecessary fcmp fold with assert
See https://reviews.llvm.org/rL312411 for related InstSimplify tests.
llvm-svn: 312421
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index afc84fc939c..006ed418c73 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -941,12 +941,9 @@ Value *InstCombiner::foldLogicOfFCmps(FCmpInst *LHS, FCmpInst *RHS, bool IsAnd) auto *LHSC = dyn_cast<ConstantFP>(LHS1); auto *RHSC = dyn_cast<ConstantFP>(RHS1); if (LHSC && RHSC) { - // If either of the constants are nans, then the whole thing returns - // true or false. - if (LHSC->getValueAPF().isNaN() || RHSC->getValueAPF().isNaN()) - return IsAnd ? Builder.getFalse() : Builder.getTrue(); - - // Otherwise, no need to compare the two constants. Compare the rest: + assert(!LHSC->getValueAPF().isNaN() && !RHSC->getValueAPF().isNaN() && + "Failed to simplify fcmp ord/uno with NAN operand"); + // Ignore the constants because they can't be NANs: // (fcmp ord x, c) & (fcmp ord y, c) -> (fcmp ord x, y) // (fcmp uno x, c) & (fcmp uno y, c) -> (fcmp uno x, y) return Builder.CreateFCmp(PredL, LHS0, RHS0); |