[llvm] r325965 - [InstSimplify] sqrt(X) * sqrt(X) --> X

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 24 07:36:06 PST 2018


It's correct that this isn't the right predicate; this was intended to be
an almost NFC cut+paste of the existing transform.

I don't think 'reassoc' alone is enough though. We also have to account for
negative numbers:
sqrt(-1.0) * sqrt(-1.0) != -1.0

On Sat, Feb 24, 2018 at 1:14 AM, Matt Arsenault <arsenm2 at gmail.com> wrote:

>
>
> On Feb 23, 2018, at 23:20, Sanjay Patel via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
> +  if (FMF.isFast() && Op0 == Op1 &&
> +      match(Op0, m_Intrinsic<Intrinsic::sqrt>(m_Value(X))))
> +    return X;
> +
>
>
> Isn’t this too strong? Shouldn’t this just be allowReassoc?
>
> -Matt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180224/862dc577/attachment.html>


More information about the llvm-commits mailing list