summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/Constants.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index 9b8670c7f3f..3ea7598c11e 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -2281,7 +2281,12 @@ Constant *ConstantExpr::getBinOpIdentity(unsigned Opcode, Type *Ty) {
case Instruction::And:
return Constant::getAllOnesValue(Ty);
- // FIXME: FAdd / FMul?
+ // TODO: If the fadd has 'nsz', should we return +0.0?
+ case Instruction::FAdd:
+ return ConstantFP::getNegativeZero(Ty);
+
+ case Instruction::FMul:
+ return ConstantFP::get(Ty, 1.0);
}
}
OpenPOWER on IntegriCloud