mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-13 14:47:00 +00:00
Have CannotBeNegativeZero() be aware of the nsz fast-math flag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169452 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6e3411375e
commit
85893f48a6
@ -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)) &&
|
||||
|
Loading…
Reference in New Issue
Block a user