[llvm] [llvm] Don't combine repeated subnormal divisors (PR #149333)
Andy Kaylor via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 17 10:20:24 PDT 2025
================
@@ -18235,6 +18235,16 @@ SDValue DAGCombiner::combineRepeatedFPDivisors(SDNode *N) {
if (N0CFP && (N0CFP->isExactlyValue(1.0) || N0CFP->isExactlyValue(-1.0)))
return SDValue();
+ // Skip if we have subnormals, multiplying with the reciprocal will introduce
+ // infinities.
+ ConstantFPSDNode *N1CFP = isConstOrConstSplatFP(N1, /* AllowUndefs */ true);
----------------
andykaylor wrote:
I kind of think the `arcp` flag allows this. I know it's not what the user would want, but that often happens with fast math.
This change still lets the operation happen if the divisor isn't constant but is dynamically subnormal, right? It seems like if we really want to stop this, the transformation should be happening somewhere that we can call `computeKnownFPClass` and check for possible subnormals, which would likely disable the transformation in most cases.
https://github.com/llvm/llvm-project/pull/149333
More information about the llvm-commits
mailing list