[llvm] [InstCombine] Transform high latency, dependent FSQRT/FDIV into FMUL (PR #87474)

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 09:23:40 PST 2025


================
@@ -666,6 +667,90 @@ Instruction *InstCombinerImpl::foldPowiReassoc(BinaryOperator &I) {
   return nullptr;
 }
 
+// Check legality for transforming
+// x = 1.0/sqrt(a)
+// r1 = x * x;
+// r2 = a/sqrt(a);
----------------
andykaylor wrote:

The semantics of the 'reassoc' flag don't explicitly allow algebraic transformations other than reassociation. It's often treated that way, but that's not what the language reference says. This is one of the things @jcranmer-intel is hoping to correct long-term. For now, we don't have another flag that clearly allows this, so I suppose we'll need to rely on 'reassoc' here.

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


More information about the llvm-commits mailing list