From dea2b93a7b61dbc311cbc2748a16639f11dece32 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Thu, 12 Mar 2020 08:45:38 -0400 Subject: [PATCH] [InstSimplify] reduce code for FP undef/nan folding; NFC --- llvm/lib/Analysis/InstructionSimplify.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index ef3ae1f..073ddb4 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -4604,13 +4604,10 @@ static Constant *propagateNaN(Constant *In) { /// transforms based on undef/NaN because the operation itself makes no /// difference to the result. static Constant *simplifyFPOp(ArrayRef Ops) { - if (any_of(Ops, [](Value *V) { return isa(V); })) - return ConstantFP::getNaN(Ops[0]->getType()); - - for (Value *V : Ops) - if (match(V, m_NaN())) + for (Value *V : Ops) { + if (match(V, m_Undef()) || match(V, m_NaN())) return propagateNaN(cast(V)); - + } return nullptr; } -- 2.7.4