[llvm] [ValueTracking] Fix computeKnownFPClass handling of nsz (PR #186315)
James Y Knight via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 9 06:16:40 PDT 2026
================
@@ -5118,9 +5118,14 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
if (Depth == MaxAnalysisRecursionDepth)
return;
+ // True only for ops where NSZ may relax the result zero sign.
+ bool AllowNSZResultRelaxation = false;
const unsigned Opc = Op->getOpcode();
switch (Opc) {
case Instruction::FNeg: {
+ // fneg(fabs(...)) always produces -0 for zero inputs.
+ AllowNSZResultRelaxation =
+ !match(Op->getOperand(0), m_Intrinsic<Intrinsic::fabs>(m_Value()));
----------------
jyknight wrote:
What justifies such special case at all? AFAIK, "fneg nsz" is permitted to return either of plus or minus zero when it gets plus or minus zero inputs -- independent of what operation that value came from.
https://github.com/llvm/llvm-project/pull/186315
More information about the llvm-commits
mailing list