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

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 08:08:36 PST 2018


Proposal to fix the FMF:
https://reviews.llvm.org/D43765

On Sat, Feb 24, 2018 at 8:36 AM, Sanjay Patel <spatel at rotateright.com>
wrote:

> 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/20180226/29fb7243/attachment.html>


More information about the llvm-commits mailing list