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:
parent
1ebeb0943e
commit
bd2183badf
@ -1313,6 +1313,11 @@ 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)) &&
|
||||
|
Loading…
Reference in New Issue
Block a user