[llvm] [InstCombine] Transform high latency, dependent FSQRT/FDIV into FMUL (PR #87474)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 4 21:51:24 PDT 2024
================
@@ -1820,6 +1989,30 @@ Instruction *InstCombinerImpl::visitFDiv(BinaryOperator &I) {
return R;
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
+
+ // Convert
+ // x = 1.0/sqrt(a)
+ // r1 = x * x;
+ // r2 = a * x;
+ //
+ // TO
+ //
+ // tmp1 = 1.0 / a
+ // tmp2 = sqrt (a)
+ // tmp3 = tmp1 * tmp2
+ // x = tmp3
+ // r1 = tmp1
+ // r2 = tmp2
----------------
sushgokh wrote:
@yashssh As said above, this might give the reader an incorrect picture that we are hoisting the r1/r2 above x. We are just hoisting the operations corresponding to r1/r2 above x.
If you and @arsenm still suggest to modify this, will change it
https://github.com/llvm/llvm-project/pull/87474
More information about the llvm-commits
mailing list