[PATCH] D86726: [InstCombine]: Transform 1.0/sqrt(X) * X to X/sqrt(X) and X * 1.0/sqrt(X) to X/sqrt(X)
Venkataramanan Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 28 01:13:25 PDT 2020
venkataramanan.kumar.llvm added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:552
+
+ // X * 1.0/sqrt(X) = X/sqrt(X).
+ if (match(Op1, (m_FDiv(m_SpecificFP(1.0), m_Value(Y)))) &&
----------------
grandinj wrote:
> Just a drive-by commentator: I am surprised there is not an existing transform which does
> 1 * X ==> X
> X * 1 ==> X
> X / 1 ==> X
Yes they are available.
This one is specifically targeting the pattern where one operand for multiplication is X and the other operand is Divide. The dividend is 1.0 and divisor is sqrt(x).
x * 1/sqrt(x) ==> x/sqrt(x) later on we try to fold it to sqrt(x) under associative math option.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86726/new/
https://reviews.llvm.org/D86726
More information about the llvm-commits
mailing list