[llvm] [InstCombine] Resolve TODO: nnan nsz X / -0.0 -> copysign(inf, X) (PR #79766)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 6 09:38:07 PST 2024
================
@@ -1598,9 +1598,11 @@ Instruction *InstCombinerImpl::foldFDivConstantDivisor(BinaryOperator &I) {
return BinaryOperator::CreateFDivFMF(X, NegC, &I);
// nnan X / +0.0 -> copysign(inf, X)
- if (I.hasNoNaNs() && match(I.getOperand(1), m_Zero())) {
+ // nnan nsz X / -0.0 -> copysign(inf, X)
+ if (I.hasNoNaNs() &&
+ (match(I.getOperand(1), m_PosZeroFP()) ||
+ (I.hasNoSignedZeros() && match(I.getOperand(1), m_NegZeroFP())))) {
----------------
arsenm wrote:
The NSZ case can be relaxed to m_AnyZeroFP
https://github.com/llvm/llvm-project/pull/79766
More information about the llvm-commits
mailing list