[llvm] r243616 - [LoopVer] Add missing std::move
Joerg Sonnenberger via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 10 04:54:40 PDT 2015
On Thu, Jul 30, 2015 at 04:21:13AM -0000, Adam Nemet wrote:
> Author: anemet
> Date: Wed Jul 29 23:21:13 2015
> New Revision: 243616
>
> URL: http://llvm.org/viewvc/llvm-project?rev=243616&view=rev
> Log:
> [LoopVer] Add missing std::move
>
> The reason I was passing this vector by value in the constructor so that
> I wouldn't have to copy when initializing the corresponding member but
> then I forgot the std::move.
>
> The use-case is LoopDistribution which filters the checks then
> std::moves it to LoopVersioning's constructor. With this interface we
> can avoid any copies.
I don't understand this. Why is it preferable to have the copy
constructor in the caller and move the result compared to using a
reference and copy construct in place?
Joerg
More information about the llvm-commits
mailing list