summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 9a0df74fd57..af35e4f88a8 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -2607,11 +2607,9 @@ 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())
- return true;
+ // (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.
if (isa<SIToFPInst>(I) || isa<UIToFPInst>(I))
OpenPOWER on IntegriCloud