<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jul 31, 2014 at 4:58 PM, Joerg Sonnenberger <span dir="ltr"><<a href="mailto:joerg@britannica.bec.de" target="_blank">joerg@britannica.bec.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Jul 21, 2014 at 06:55:05PM -0700, Richard Smith wrote:<br>
> Index: include/llvm/ADT/APInt.h<br>
> ===================================================================<br>
> --- include/llvm/ADT/APInt.h  (revision 213404)<br>
> +++ include/llvm/ADT/APInt.h  (working copy)<br>
> @@ -1756,13 +1756,13 @@<br>
>  /// \brief Returns the floor log base 2 of the specified APInt value.<br>
>  inline unsigned logBase2(const APInt &APIVal) { return APIVal.logBase2(); }<br>
><br>
> -/// \brief Compute GCD of two APInt values.<br>
> +/// \brief Compute GCD of two unsigned APInt values.<br>
>  ///<br>
>  /// This function returns the greatest common divisor of the two APInt values<br>
>  /// using Euclid's algorithm.<br>
>  ///<br>
>  /// \returns the greatest common divisor of Val1 and Val2<br>
> -APInt GreatestCommonDivisor(const APInt &Val1, const APInt &Val2);<br>
> +APInt GreatestCommonDivisor(APInt Val1, APInt Val2);<br>
<br>
Doesn't this create an unnecessary copy in many common cases?</blockquote><div><br></div><div>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.</div>
</div></div></div>