[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-commits
Subject: Re: [PATCH] D11394: Fix warnings about pessimizing return moves for C++11 and higher
From: Richard Smith <richard () metafoo ! co ! uk>
Date: 2015-07-26 0:54:27
Message-ID: CAOfiQq=5BZUptTafa8ZVx+Eo5++-1m9HtVBze7C1Hn3Vn2_gHw () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On Sat, Jul 25, 2015 at 6:57 AM, Dimitry Andric <dimitry@andric.com> wrote:
> dim added inline comments.
>
> ================
> Comment at: include/__config:724
> @@ -719,1 +723,3 @@
> +#endif
> +
> #ifndef _LIBCPP_HAS_NO_ASAN
> ----------------
> mclow.lists wrote:
> > I think that this needs more exploration; someone needs to look at the
> codegen.
> >
> > return x;
> >
> > is different from:
> >
> > return (x); // this is an expression
> >
> > I suspect that only one will trigger RVO.
> >
> Would you really think so? I would think the parentheses are superfluous,
> and can be removed by parsing stages before it gets to RVO. But I will try
> to check the codegen anyway.
>
Please file a bug if you find any cases where the parenthesized and
non-parenthesized form behave differently wrt RVO / NRVO.
> Alternatively, since the macro is for 'internal use only', we might try to
> just remove the parentheses, e.g.:
>
> #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
> # define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
> #else
> # define _LIBCPP_EXPLICIT_MOVE(x) x
> #endif
>
> It is a bit ugly, but at least the code itself does not have to be
> littered with #ifdefs.
>
>
> http://reviews.llvm.org/D11394
>
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
[Attachment #5 (text/html)]
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jul 25, 2015 \
at 6:57 AM, Dimitry Andric <span dir="ltr"><<a href="mailto:dimitry@andric.com" \
target="_blank">dimitry@andric.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">dim added inline comments.<br> <span class=""><br>
================<br>
Comment at: include/__config:724<br>
@@ -719,1 +723,3 @@<br>
+#endif<br>
+<br>
#ifndef _LIBCPP_HAS_NO_ASAN<br>
----------------<br>
</span><span class="">mclow.lists wrote:<br>
> I think that this needs more exploration; someone needs to look at the \
codegen.<br> ><br>
> return x;<br>
><br>
> is different from:<br>
><br>
> return (x); // this is an expression<br>
><br>
> I suspect that only one will trigger RVO.<br>
><br>
</span>Would you really think so? I would think the parentheses are superfluous, \
and can be removed by parsing stages before it gets to RVO. But I will try to check \
the codegen anyway.<br></blockquote><div><br></div><div>Please file a bug if you find \
any cases where the parenthesized and non-parenthesized form behave differently wrt \
RVO / NRVO.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"> Alternatively, since the macro is \
for 'internal use only', we might try to just remove the parentheses, \
e.g.:<br> <br>
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES<br>
# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)<br>
#else<br>
# define _LIBCPP_EXPLICIT_MOVE(x) x<br>
#endif<br>
<br>
It is a bit ugly, but at least the code itself does not have to be littered with \
#ifdefs.<br> <div class="HOEnZb"><div class="h5"><br>
<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D11394&d \
=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=YweN4 \
0EUfrVmkIbQEcnMYujybOj_ITPuk0lITpstzdM&s=A_760azcAw6xw0mhGuQIBYWYRB30Hn8zvICBB6je0aI&e=" \
rel="noreferrer" target="_blank">http://reviews.llvm.org/D11394</a><br> <br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" rel="noreferrer" \
target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br> \
</div></div></blockquote></div><br></div></div>
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic