public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Christophe Lyon <christophe.lyon.oss@gmail.com>
To: Martin Sebor <msebor@gmail.com>
Cc: Jason Merrill <jason@redhat.com>,
	Jonathan Wakely <jwakely@redhat.com>,
	 Richard Biener <richard.guenther@gmail.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	 Tamar Christina <tamar.christina@arm.com>
Subject: Re: [PING][PATCH] define auto_vec copy ctor and assignment (PR 90904)
Date: Fri, 6 Aug 2021 14:17:14 +0200	[thread overview]
Message-ID: <CAKhMtS+JVVAwv+utiEVaw9HoEekEarJQ=i1Kd5W1Pvsym4d7=A@mail.gmail.com> (raw)
In-Reply-To: <CAKhMtS+ErywySfqVVzsZ6b7RX1y0KQC0keuSh+6zC9_sZGb19Q@mail.gmail.com>

On Fri, Aug 6, 2021 at 9:52 AM Christophe Lyon <
christophe.lyon.oss@gmail.com> wrote:

>
>
> On Fri, Aug 6, 2021 at 4:07 AM Martin Sebor via Gcc-patches <
> gcc-patches@gcc.gnu.org> wrote:
>
>> On 7/30/21 9:06 AM, Jason Merrill wrote:
>> > On 7/27/21 2:56 PM, Martin Sebor wrote:
>> >> Ping: https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575690.html
>> >>
>> >> Are there any other suggestions or comments or is the latest revision
>> >> okay to commit?
>> >
>> > OK.
>>
>> I had to make a few more adjustments to fix up code that's snuck
>> in since I last tested the patch.  I committed r12-2776 after
>> retesting on x86_64-linux.
>>
>> With the cleanup out of the way I'll resubmit the copy ctor patch
>> next.
>>
>>
> Hi Martin,
>
> Your patch breaks the aarch64 build:
>  /tmp/1784440_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/config/aarch64/aarch64-sve-builtins.cc:
> In function 'void aarch64_sve::register_svpattern()':
> /tmp/1784440_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/config/aarch64/aarch64-sve-builtins.cc:3502:27:
> error: use of deleted function 'vec<T>::vec(auto_vec<T, N>&) [with long
> unsigned int N = 32ul;
> T = std::pair<const char*, int>]'
>         "svpattern", values);
>                            ^
> In file included from
> /tmp/1784440_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/hash-table.h:248:0,
>                  from
> /tmp/1784440_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/coretypes.h:480,
>                  from
> /tmp/1784440_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/config/aarch64/aarch64-sve-builtins.cc:24:
> /tmp/1784440_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/vec.h:1455:3:
> error: declared here
>    vec (auto_vec<T, N> &) = delete;
>    ^
> /tmp/1784440_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/config/aarch64/aarch64-sve-builtins.cc:
> In function 'void aarch64_sve::register_svprfop()':
> /tmp/1784440_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/config/aarch64/aarch64-sve-builtins.cc:3516:30:
> error: use of deleted function 'vec<T>::vec(auto_vec<T, N>&) [with long
> unsigned int N = 16ul;
> T = std::pair<const char*, int>]'
>              "svprfop", values);
>                               ^
> In file included from
> /tmp/1784440_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/hash-table.h:248:0,
>                  from
> /tmp/1784440_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/coretypes.h:480,
>                  from
> /tmp/1784440_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/config/aarch64/aarch64-sve-builtins.cc:24:
> /tmp/1784440_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/vec.h:1455:3:
> error: declared here
>    vec (auto_vec<T, N> &) = delete;
>    ^
>
> Can you check?
>
> Thanks,
>

This has now been fixed by Tamar, thanks!

Christophe


>
> Christophe
>
>>
>> Martin
>>
>> >
>> >> On 7/20/21 12:34 PM, Martin Sebor wrote:
>> >>> On 7/14/21 10:23 AM, Jason Merrill wrote:
>> >>>> On 7/14/21 10:46 AM, Martin Sebor wrote:
>> >>>>> On 7/13/21 9:39 PM, Jason Merrill wrote:
>> >>>>>> On 7/13/21 4:02 PM, Martin Sebor wrote:
>> >>>>>>> On 7/13/21 12:37 PM, Jason Merrill wrote:
>> >>>>>>>> On 7/13/21 10:08 AM, Jonathan Wakely wrote:
>> >>>>>>>>> On Mon, 12 Jul 2021 at 12:02, Richard Biener wrote:
>> >>>>>>>>>> Somebody with more C++ knowledge than me needs to approve the
>> >>>>>>>>>> vec.h changes - I don't feel competent to assess all effects
>> >>>>>>>>>> of the change.
>> >>>>>>>>>
>> >>>>>>>>> They look OK to me except for:
>> >>>>>>>>>
>> >>>>>>>>> -extern vnull vNULL;
>> >>>>>>>>> +static constexpr vnull vNULL{ };
>> >>>>>>>>>
>> >>>>>>>>> Making vNULL have static linkage can make it an ODR violation
>> >>>>>>>>> to use
>> >>>>>>>>> vNULL in templates and inline functions, because different
>> >>>>>>>>> instantiations will refer to a different "vNULL" in each
>> >>>>>>>>> translation
>> >>>>>>>>> unit.
>> >>>>>>>>
>> >>>>>>>> The ODR says this is OK because it's a literal constant with the
>> >>>>>>>> same value (6.2/12.2.1).
>> >>>>>>>>
>> >>>>>>>> But it would be better without the explicit 'static'; then in
>> >>>>>>>> C++17 it's implicitly inline instead of static.
>> >>>>>>>
>> >>>>>>> I'll remove the static.
>> >>>>>>>
>> >>>>>>>>
>> >>>>>>>> But then, do we really want to keep vNULL at all?  It's a weird
>> >>>>>>>> blurring of the object/pointer boundary that is also dependent
>> >>>>>>>> on vec being a thin wrapper around a pointer.  In almost all
>> >>>>>>>> cases it can be replaced with {}; one exception is ==
>> >>>>>>>> comparison, where it seems to be testing that the embedded
>> >>>>>>>> pointer is null, which is a weird thing to want to test.
>> >>>>>>>
>> >>>>>>> The one use case I know of for vNULL where I can't think of
>> >>>>>>> an equally good substitute is in passing a vec as an argument by
>> >>>>>>> value.  The only way to do that that I can think of is to name
>> >>>>>>> the full vec type (i.e., the specialization) which is more typing
>> >>>>>>> and less generic than vNULL.  I don't use vNULL myself so I
>> wouldn't
>> >>>>>>> miss this trick if it were to be removed but others might feel
>> >>>>>>> differently.
>> >>>>>>
>> >>>>>> In C++11, it can be replaced by {} in that context as well.
>> >>>>>
>> >>>>> Cool.  I thought I'd tried { } here but I guess not.
>> >>>>>
>> >>>>>>
>> >>>>>>> If not, I'm all for getting rid of vNULL but with over 350 uses
>> >>>>>>> of it left, unless there's some clever trick to make the removal
>> >>>>>>> (mostly) effortless and seamless, I'd much rather do it
>> >>>>>>> independently
>> >>>>>>> of this initial change. I also don't know if I can commit to
>> making
>> >>>>>>> all this cleanup.
>> >>>>>>
>> >>>>>> I already have a patch to replace all but one use of vNULL, but
>> >>>>>> I'll hold off with it until after your patch.
>> >>>>>
>> >>>>> So what's the next step?  The patch only removes a few uses of vNULL
>> >>>>> but doesn't add any.  Is it good to go as is (without the static and
>> >>>>> with the additional const changes Richard suggested)?  This patch is
>> >>>>> attached to my reply to Richard:
>> >>>>> https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575199.html
>> >>>>
>> >>>> As Richard wrote:
>> >>>>
>> >>>>> The pieces where you change vec<> passing to const vec<>& and the
>> few
>> >>>>> where you change vec<> * to const vec<> * are OK - this should make
>> >>>>> the
>> >>>>> rest a smaller piece to review.
>> >>>>
>> >>>> Please go ahead and apply those changes and send a new patch with
>> >>>> the remainder of the changes.
>> >>>
>> >>> I have just pushed r12-2418:
>> >>> https://gcc.gnu.org/pipermail/gcc-cvs/2021-July/350886.html
>> >>>
>> >>>>
>> >>>> A few other comments:
>> >>>>
>> >>>>> -                       omp_declare_simd_clauses);
>> >>>>> +                       *omp_declare_simd_clauses);
>> >>>>
>> >>>> Instead of doing this indirection in all of the callers, let's
>> >>>> change c_finish_omp_declare_simd to take a pointer as well, and do
>> >>>> the indirection in initializing a reference variable at the top of
>> >>>> the function.
>> >>>
>> >>> Okay.
>> >>>
>> >>>>
>> >>>>> +    sched_init_luids (bbs.to_vec ());
>> >>>>> +    haifa_init_h_i_d (bbs.to_vec ());
>> >>>>
>> >>>> Why are these to_vec changes needed when you are also changing the
>> >>>> functions to take const&?
>> >>>
>> >>> Calling to_vec() here isn't necessary so I've removed it.
>> >>>
>> >>>>
>> >>>>> -  vec<tree> checks = LOOP_VINFO_CHECK_NONZERO (loop_vinfo);
>> >>>>> +  vec<tree> checks = LOOP_VINFO_CHECK_NONZERO (loop_vinfo).to_vec
>> ();
>> >>>>
>> >>>> Why not use a reference here and in other similar spots?
>> >>>
>> >>> Sure, that works too.
>> >>>
>> >>> Attached is what's left of the original changes now that r12-2418
>> >>> has been applied.
>> >>>
>> >>> Martin
>> >>
>> >
>>
>>

  reply	other threads:[~2021-08-06 12:17 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 23:30 [PATCH] " Martin Sebor
2021-04-27  7:58 ` Richard Biener
2021-04-27 13:58   ` Martin Sebor
2021-04-27 14:04     ` Richard Biener
2021-04-27 15:52       ` Martin Sebor
2021-05-03 21:50         ` [PING][PATCH] " Martin Sebor
2021-05-11 20:02           ` [PING 2][PATCH] " Martin Sebor
2021-05-27 19:33             ` [PING 3][PATCH] " Martin Sebor
2021-05-27 20:53         ` [PATCH] " Jason Merrill
2021-06-01 19:56           ` Martin Sebor
2021-06-01 21:38             ` Jason Merrill
2021-06-25 20:51               ` Martin Sebor
2021-06-25 22:11                 ` Jason Merrill
2021-06-25 22:36                   ` Martin Sebor
2021-06-28  8:07                     ` Richard Biener
2021-06-28 18:07                       ` Martin Sebor
2021-06-29 10:58                         ` Richard Biener
2021-06-29 11:34                           ` Martin Jambor
2021-06-30  1:46                           ` Martin Sebor
2021-06-30  8:48                             ` Richard Biener
2021-06-30  9:29                               ` Martin Jambor
2021-07-06 15:06                             ` [PING][PATCH] " Martin Sebor
2021-07-07  7:28                               ` Richard Biener
2021-07-07 14:37                                 ` Martin Sebor
2021-07-12 11:02                                   ` Richard Biener
2021-07-13 14:08                                     ` Jonathan Wakely
2021-07-13 18:37                                       ` Jason Merrill
2021-07-13 20:02                                         ` Martin Sebor
2021-07-14  3:39                                           ` Jason Merrill
2021-07-14 10:47                                             ` Jonathan Wakely
2021-07-14 14:46                                             ` Martin Sebor
2021-07-14 16:23                                               ` Jason Merrill
2021-07-20 18:34                                                 ` Martin Sebor
2021-07-20 20:08                                                   ` Jason Merrill
2021-07-20 21:52                                                     ` Martin Sebor
2021-07-27 18:56                                                   ` Martin Sebor
2021-07-30 15:06                                                     ` Jason Merrill
2021-08-06  2:07                                                       ` Martin Sebor
2021-08-06  7:52                                                         ` Christophe Lyon
2021-08-06 12:17                                                           ` Christophe Lyon [this message]
2021-07-14 14:44                                     ` Martin Sebor
2021-06-29 14:43                         ` [PATCH] " Jason Merrill
2021-06-29 17:18                           ` Martin Sebor
2021-06-30  8:40                             ` Richard Biener
2021-06-30  9:00                               ` Richard Sandiford
2021-06-30 12:01                                 ` Richard Biener
2021-06-28  8:05                 ` Richard Biener
2021-06-29 12:30                 ` Trevor Saunders
2021-06-02  6:55             ` Richard Biener
2021-06-02 16:04               ` Martin Sebor
2021-06-03  8:29                 ` Trevor Saunders
2021-06-07  8:51                   ` Richard Biener
2021-06-07 10:33                     ` Trevor Saunders
2021-06-07 13:33                       ` Richard Biener
2021-06-07 20:34                     ` Martin Sebor
2021-06-08  3:26                       ` Trevor Saunders
2021-06-08  7:19                         ` Richard Biener
2021-06-07 22:17                   ` Martin Sebor
2021-06-08  2:41                     ` Trevor Saunders

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKhMtS+JVVAwv+utiEVaw9HoEekEarJQ=i1Kd5W1Pvsym4d7=A@mail.gmail.com' \
    --to=christophe.lyon.oss@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=jwakely@redhat.com \
    --cc=msebor@gmail.com \
    --cc=richard.guenther@gmail.com \
    --cc=tamar.christina@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).