From: Michael Ilseman Date: Thu, 6 Dec 2012 00:07:09 +0000 (+0000) Subject: Have CannotBeNegativeZero() be aware of the nsz fast-math flag X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0f12837be0a736623c51c8a6499cda66ccc64c26;p=platform%2Fupstream%2Fllvm.git Have CannotBeNegativeZero() be aware of the nsz fast-math flag llvm-svn: 169452 --- diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 47b1db6..eee231d 100644 --- 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(V); if (I == 0) return false; - + + // Check if the nsz fast-math flag is set + if (const FPMathOperator *FPO = dyn_cast(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(I->getOperand(1)) &&