[PATCH] D126774: [InstCombine] Use +0.0 instead of -0.0 as the FP identity for some folds
David Sherwood via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 7 03:54:13 PDT 2022
david-arm marked 4 inline comments as done.
david-arm added inline comments.
================
Comment at: llvm/lib/IR/Constants.cpp:2854-2855
// TODO: If the fadd has 'nsz', should we return +0.0?
- return ConstantFP::getNegativeZero(Ty);
+ return NSZ ? Constant::getNullValue(Ty)
+ : ConstantFP::getNegativeZero(Ty);
case Instruction::FMul: // X * 1.0 = X
----------------
spatel wrote:
> This API is awkward. Should we change the constant's method to take a positive/negative param (to match the APFloat call within this call)?
> ConstantFP::getZero(Type, bool Negative = false)
Good suggestion @spatel !
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126774/new/
https://reviews.llvm.org/D126774
More information about the llvm-commits
mailing list