[PATCH] Fold together repeated tests for divisibility by constants

Richard Smith richard at metafoo.co.uk
Thu Sep 4 16:57:13 PDT 2014


Ping.


On Mon, Aug 25, 2014 at 4:10 PM, Richard Smith <richard at metafoo.co.uk>
wrote:

> Ping.
>
>
> On Wed, Aug 13, 2014 at 6:27 PM, Richard Smith <richard at metafoo.co.uk>
> wrote:
>
>> On Thu, Jul 31, 2014 at 4:58 PM, Joerg Sonnenberger <
>> joerg at britannica.bec.de> wrote:
>>
>>> On Mon, Jul 21, 2014 at 06:55:05PM -0700, Richard Smith wrote:
>>> > Index: include/llvm/ADT/APInt.h
>>> > ===================================================================
>>> > --- include/llvm/ADT/APInt.h  (revision 213404)
>>> > +++ include/llvm/ADT/APInt.h  (working copy)
>>> > @@ -1756,13 +1756,13 @@
>>> >  /// \brief Returns the floor log base 2 of the specified APInt value.
>>> >  inline unsigned logBase2(const APInt &APIVal) { return
>>> APIVal.logBase2(); }
>>> >
>>> > -/// \brief Compute GCD of two APInt values.
>>> > +/// \brief Compute GCD of two unsigned APInt values.
>>> >  ///
>>> >  /// This function returns the greatest common divisor of the two
>>> APInt values
>>> >  /// using Euclid's algorithm.
>>> >  ///
>>> >  /// \returns the greatest common divisor of Val1 and Val2
>>> > -APInt GreatestCommonDivisor(const APInt &Val1, const APInt &Val2);
>>> > +APInt GreatestCommonDivisor(APInt Val1, APInt Val2);
>>>
>>> Doesn't this create an unnecessary copy in many common cases?
>>
>>
>> This is no worse than the previous algorithm, which began by making
>> copies of both of its arguments, and is better in the case where the
>> arguments are temporaries.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140904/8942ed39/attachment.html>


More information about the llvm-commits mailing list