[llvm] [InstCombine] Transform high latency, dependent FSQRT/FDIV into FMUL (PR #87474)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed May 8 08:50:53 PDT 2024
================
@@ -626,6 +626,89 @@ Instruction *InstCombinerImpl::foldPowiReassoc(BinaryOperator &I) {
return nullptr;
}
+// Check legality for transforming
+// x = 1.0/sqrt(a)
+// r1 = x * x;
+// r2 = a/sqrt(a);
+//
+// TO
+//
+// r1 = 1/a
+// r2 = sqrt(a)
+// x = r1 * r2
+static bool isFSqrtDivToFMulLegal(Instruction *X,
+ const SmallVectorImpl<Instruction *> &R1,
+ const SmallVectorImpl<Instruction *> &R2) {
----------------
arsenm wrote:
const ref of vector can be ArrayRef
https://github.com/llvm/llvm-project/pull/87474
More information about the llvm-commits
mailing list