[ValueTracking] simplify code in CannotBeNegativeZero() with match(); NFCI

llvm-svn: 318055
This commit is contained in:
Sanjay Patel 2017-11-13 17:40:47 +00:00
parent 5df6b94381
commit 9e3d8f4b39
1 changed files with 3 additions and 5 deletions

View File

@ -2607,10 +2607,8 @@ bool llvm::CannotBeNegativeZero(const Value *V, const TargetLibraryInfo *TLI,
if (FPO->hasNoSignedZeros())
return true;
// (add x, 0.0) is guaranteed to return +0.0, not -0.0.
if (I->getOpcode() == Instruction::FAdd)
if (ConstantFP *CFP = dyn_cast<ConstantFP>(I->getOperand(1)))
if (CFP->isNullValue())
// (fadd x, 0.0) is guaranteed to return +0.0, not -0.0.
if (match(I, m_FAdd(m_Value(), m_Zero())))
return true;
// sitofp and uitofp turn into +0.0 for zero.