From cba94587c780e7f6173d5cab9eb9f5d1b3e0f6c9 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Sat, 2 Sep 2017 18:10:29 +0000 Subject: [PATCH] [InstCombine] replace unnecessary fcmp fold with assert See https://reviews.llvm.org/rL312411 for related InstSimplify tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312421 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index afc84fc939c..006ed418c73 100644 --- a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -941,12 +941,9 @@ Value *InstCombiner::foldLogicOfFCmps(FCmpInst *LHS, FCmpInst *RHS, bool IsAnd) auto *LHSC = dyn_cast(LHS1); auto *RHSC = dyn_cast(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); -- 2.11.0