forked from OSchip/llvm-project
[ValueTracking] simplify code in CannotBeNegativeZero() with match(); NFCI
llvm-svn: 318055
This commit is contained in:
parent
5df6b94381
commit
9e3d8f4b39
|
@ -2607,11 +2607,9 @@ bool llvm::CannotBeNegativeZero(const Value *V, const TargetLibraryInfo *TLI,
|
||||||
if (FPO->hasNoSignedZeros())
|
if (FPO->hasNoSignedZeros())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// (add x, 0.0) is guaranteed to return +0.0, not -0.0.
|
// (fadd x, 0.0) is guaranteed to return +0.0, not -0.0.
|
||||||
if (I->getOpcode() == Instruction::FAdd)
|
if (match(I, m_FAdd(m_Value(), m_Zero())))
|
||||||
if (ConstantFP *CFP = dyn_cast<ConstantFP>(I->getOperand(1)))
|
return true;
|
||||||
if (CFP->isNullValue())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// sitofp and uitofp turn into +0.0 for zero.
|
// sitofp and uitofp turn into +0.0 for zero.
|
||||||
if (isa<SIToFPInst>(I) || isa<UIToFPInst>(I))
|
if (isa<SIToFPInst>(I) || isa<UIToFPInst>(I))
|
||||||
|
|
Loading…
Reference in New Issue