[llvm] r302404 - [SCEV] Use APInt::operator*=(uint64_t) to avoid a temporary APInt for a constant.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 10:30:37 PDT 2017


Two gets passed to sdiv which we don't currently have a uint64_t version
of. I might look into that, but the divide code scared me away.

~Craig

On Mon, May 8, 2017 at 10:08 AM, David Blaikie <dblaikie at gmail.com> wrote:

> It's not beneficial to do the same thing for 'Two' as well?
>
> On Sun, May 7, 2017 at 10:08 PM Craig Topper via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: ctopper
>> Date: Sun May  7 23:55:13 2017
>> New Revision: 302404
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=302404&view=rev
>> Log:
>> [SCEV] Use APInt::operator*=(uint64_t) to avoid a temporary APInt for a
>> constant.
>>
>> Modified:
>>     llvm/trunk/lib/Analysis/ScalarEvolution.cpp
>>
>> Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
>> Analysis/ScalarEvolution.cpp?rev=302404&r1=302403&r2=302404&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
>> +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun May  7 23:55:13 2017
>> @@ -7376,7 +7376,6 @@ SolveQuadraticEquation(const SCEVAddRecE
>>    const APInt &M = MC->getAPInt();
>>    const APInt &N = NC->getAPInt();
>>    APInt Two(BitWidth, 2);
>> -  APInt Four(BitWidth, 4);
>>
>>    {
>>      using namespace APIntOps;
>> @@ -7392,7 +7391,7 @@ SolveQuadraticEquation(const SCEVAddRecE
>>      // Compute the B^2-4ac term.
>>      APInt SqrtTerm(B);
>>      SqrtTerm *= B;
>> -    SqrtTerm -= Four * (A * C);
>> +    SqrtTerm -= 4 * (A * C);
>>
>>      if (SqrtTerm.isNegative()) {
>>        // The loop is provably infinite.
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170508/4062dd94/attachment-0001.html>


More information about the llvm-commits mailing list