diff options
author | Michael Ilseman <milseman@apple.com> | 2012-12-06 00:07:09 +0000 |
---|---|---|
committer | Michael Ilseman <milseman@apple.com> | 2012-12-06 00:07:09 +0000 |
commit | 85893f48a6994d71414773175440c421e5341810 (patch) | |
tree | c405de6a94e7ea8e90aedc76cd888fec6488fefa /lib/Analysis | |
parent | 6e3411375e3ec2c99eebcda30f99a29504566566 (diff) | |
download | external_llvm-85893f48a6994d71414773175440c421e5341810.zip external_llvm-85893f48a6994d71414773175440c421e5341810.tar.gz external_llvm-85893f48a6994d71414773175440c421e5341810.tar.bz2 |
Have CannotBeNegativeZero() be aware of the nsz fast-math flag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169452 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/ValueTracking.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index 47b1db6..eee231d 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -1312,7 +1312,12 @@ bool llvm::CannotBeNegativeZero(const Value *V, unsigned Depth) { const Operator *I = dyn_cast<Operator>(V); if (I == 0) return false; - + + // Check if the nsz fast-math flag is set + if (const FPMathOperator *FPO = dyn_cast<FPMathOperator>(I)) + if (FPO->hasNoSignedZeros()) + return true; + // (add x, 0.0) is guaranteed to return +0.0, not -0.0. if (I->getOpcode() == Instruction::FAdd && isa<ConstantFP>(I->getOperand(1)) && |