Re: [PATCH] c++: fold calls to std::move/forward [PR96780]

2022-03-15 Thread Jason Merrill via Gcc-patches
;s non-standard). I suppose it also doesn't hurt to verify that the return and argument type of the function are sane before we commit to folding. -- >8 -- Subject: [PATCH] c++: fold calls to std::move/forward [PR96780] A well-formed call to std::move/forward is equivalent to a cast, but

Re: [PATCH] c++: fold calls to std::move/forward [PR96780]

2022-03-15 Thread Patrick Palka via Gcc-patches
std_move_p, is_std_forward_p): Export. > > > > > > > > > > > > > > > > gcc/testsuite/ChangeLog: > > > > > > > > > > > > > > > > * g++.dg/opt/pr96780.C: New test. > > > > > > >

Re: [PATCH] c++: fold calls to std::move/forward [PR96780]

2022-03-15 Thread Jason Merrill via Gcc-patches
ment type of the function are sane before we commit to folding. -- >8 -- Subject: [PATCH] c++: fold calls to std::move/forward [PR96780] A well-formed call to std::move/forward is equivalent to a cast, but the former being a function call means the compiler generates debug info for it, which pers

Re: [PATCH] c++: fold calls to std::move/forward [PR96780]

2022-03-15 Thread Patrick Palka via Gcc-patches
k.cc | 6 ++---- > > > > > > gcc/testsuite/g++.dg/opt/pr96780.C | 24 > > > > > > 4 files changed, 46 insertions(+), 4 deletions(-) > > > > > > create mode 100644 gcc/testsuite/g++.dg/opt/pr96780.C

Re: [PATCH] c++: fold calls to std::move/forward [PR96780]

2022-03-14 Thread Jason Merrill via Gcc-patches
#x27;t add front-end options to the default_options_table. But I think let's use OPTION_SET_P instead of checking for -1. -- >8 -- Subject: [PATCH] c++: fold calls to std::move/forward [PR96780] A well-formed call to std::move/forward is equivalent to a cast, but the former being a f

Re: [PATCH] c++: fold calls to std::move/forward [PR96780]

2022-03-14 Thread Patrick Palka via Gcc-patches
96780.C > > > > > > > > diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc > > > > index d7323fb5c09..0b009b631c7 100644 > > > > --- a/gcc/cp/cp-gimplify.cc > > > > +++ b/gcc/cp/cp-gimplify.cc > > > > @@ -2756,6 +2756,

Re: [PATCH] c++: fold calls to std::move/forward [PR96780]

2022-03-11 Thread Jason Merrill via Gcc-patches
of unsure about since it's non-standard). I suppose it also doesn't hurt to verify that the return and argument type of the function are sane before we commit to folding. -- >8 -- Subject: [PATCH] c++: fold calls to std::move/forward [PR96780] A well-formed call to std::move/forward is e

Re: [PATCH] c++: fold calls to std::move/forward [PR96780]

2022-03-10 Thread Jonathan Wakely via Gcc-patches
On Thu, 10 Mar 2022 at 15:27, Patrick Palka wrote: > Here's a patch that extends the folding to as_const and addressof (as > well as __addressof, which I'm kind of unsure about since it's > non-standard). N.B. libstdc++ almost never uses std::addressof, because that calls std::__addressof, so we j

Re: [PATCH] c++: fold calls to std::move/forward [PR96780]

2022-03-10 Thread Patrick Palka via Gcc-patches
gt; > +++ b/gcc/cp/cp-gimplify.cc > > @@ -2756,6 +2756,24 @@ cp_fold (tree x) > > case CALL_EXPR: > > { > > + if (optimize > > I think this should check flag_no_inline rather than optimize. Sounds good. Here's a patch that extends the fol

Re: [PATCH] c++: fold calls to std::move/forward [PR96780]

2022-03-09 Thread Jason Merrill via Gcc-patches
On 3/1/22 18:08, Patrick Palka wrote: A well-formed call to std::move/forward is equivalent to a cast, but the former being a function call means it comes with bloated debug info, which persists even after the call has been inlined away, for an operation that is never interesting to debug. This

[PATCH] c++: fold calls to std::move/forward [PR96780]

2022-03-01 Thread Patrick Palka via Gcc-patches
A well-formed call to std::move/forward is equivalent to a cast, but the former being a function call means it comes with bloated debug info, which persists even after the call has been inlined away, for an operation that is never interesting to debug. This patch addresses this problem in a relati