projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
faa0bb3
)
Have CannotBeNegativeZero() be aware of the nsz fast-math flag
author
Michael Ilseman
<milseman@apple.com>
Thu, 6 Dec 2012 00:07:09 +0000
(
00:07
+0000)
committer
Michael Ilseman
<milseman@apple.com>
Thu, 6 Dec 2012 00:07:09 +0000
(
00:07
+0000)
llvm-svn: 169452
llvm/lib/Analysis/ValueTracking.cpp
patch
|
blob
|
history
diff --git
a/llvm/lib/Analysis/ValueTracking.cpp
b/llvm/lib/Analysis/ValueTracking.cpp
index
47b1db6
..
eee231d
100644
(file)
--- a/
llvm/lib/Analysis/ValueTracking.cpp
+++ b/
llvm/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)) &&