[llvm-commits] [llvm] r169452 - /llvm/trunk/lib/Analysis/ValueTracking.cpp
Michael Ilseman
milseman at apple.com
Wed Dec 5 16:07:09 PST 2012
Author: milseman
Date: Wed Dec 5 18:07:09 2012
New Revision: 169452
URL: http://llvm.org/viewvc/llvm-project?rev=169452&view=rev
Log:
Have CannotBeNegativeZero() be aware of the nsz fast-math flag
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=169452&r1=169451&r2=169452&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Wed Dec 5 18:07:09 2012
@@ -1312,7 +1312,12 @@
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)) &&
More information about the llvm-commits
mailing list