[llvm] [AMDGPU] Do not propagate ninf/nsz from sqrt when forming rsq (PR #217599)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 11:11:37 PDT 2026


================
@@ -742,9 +742,13 @@ Value *AMDGPUCodeGenPrepareImpl::optimizeWithRsq(
 
   // TODO: Handle other numerator values with arcp.
   if (CLHS->isOne() || (IsNegative = CLHS->isMinusOne())) {
-    // Add in the sqrt flags.
+    // Add sqrt flags, but keep ninf/nsz from the div: they don't say
+    // anything about the quotient.
     IRBuilder<>::FastMathFlagGuard Guard(Builder);
-    Builder.setFastMathFlags(DivFMF | SqrtFMF);
+    FastMathFlags NewFMF = DivFMF | SqrtFMF;
----------------
arsenm wrote:

we have unionValue and intersectRewrite

https://github.com/llvm/llvm-project/pull/217599


More information about the llvm-commits mailing list