[PATCH] D32943: [SCEV] Use move semantics in ScalarEvolution::setRange

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 10:17:14 PDT 2017


On Sat, May 6, 2017 at 6:11 PM Takuto Ikuta via Phabricator via
llvm-commits <llvm-commits at lists.llvm.org> wrote:

> takuto.ikuta added inline comments.
>
>
> ================
> Comment at: include/llvm/Analysis/ScalarEvolution.h:785
>    const ConstantRange &setRange(const SCEV *S, RangeSignHint Hint,
> -                                const ConstantRange &CR) {
> +                                ConstantRange CR) {
>      DenseMap<const SCEV *, ConstantRange> &Cache =
> ----------------
> Better to change type to `ConstantRange&&`?
>

Generally I find it preferable to pass by value - this allows the caller to
pass an rvalue or lvalue and it does the right thing either way. It's rare
that the callee should be forcing the caller to do one or the other, I
think?

- Dave


>
>
> https://reviews.llvm.org/D32943
>
>
>
> _______________________________________________
> 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/33f6e531/attachment.html>


More information about the llvm-commits mailing list