1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

Have CannotBeNegativeZero() be aware of the nsz fast-math flag

llvm-svn: 169452
This commit is contained in:
Michael Ilseman 2012-12-06 00:07:09 +00:00
parent 1ebeb0943e
commit bd2183badf

View File

@ -1312,7 +1312,12 @@ bool llvm::CannotBeNegativeZero(const Value *V, unsigned Depth) {
const Operator *I = dyn_cast<Operator>(V); const Operator *I = dyn_cast<Operator>(V);
if (I == 0) return false; 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. // (add x, 0.0) is guaranteed to return +0.0, not -0.0.
if (I->getOpcode() == Instruction::FAdd && if (I->getOpcode() == Instruction::FAdd &&
isa<ConstantFP>(I->getOperand(1)) && isa<ConstantFP>(I->getOperand(1)) &&