From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by sourceware.org (Postfix) with ESMTPS id D69D0396BC04 for ; Fri, 6 Aug 2021 12:17:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D69D0396BC04 Received: by mail-il1-x129.google.com with SMTP id x7so8635759ilh.10 for ; Fri, 06 Aug 2021 05:17:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cLPXLrNPvuN8lr4ZX0TQ0pC1Vp0ujs53CW1cIMuvo+s=; b=tQFjLlTIei/uxFgJmfHewBxVD7ve2GI6zSgx5vfqeDJMi0osOae9zjltKfC/xPDITn cRbbv4kTPZYCHg1nxQE+0qAdqvgZQGQbFNn7tHQcOzj4NK2+uSyyt5Ote3jtwknXiax7 pwInIwCl05OCcqLU6PpOphFdOLOBxSTZMtMRfhJBrNjjqHzCal5INQZAMqGkvIx75WjP CeVPmmr7R0YhIgxW5KnkOIAGOYuyeqKJFkYUjHFrw8DR0BMzOrPidwbAFeUZLE4J9ByA 63y6fVWmIze6vk4A92b1WgJ2s+8R3JrZWoY1rSmso+jTDb1bBnGqaKuO9Pm/gf4qmKvl yf0A== X-Gm-Message-State: AOAM532SH5zPumA48egg1jm/ffSK4MKSHx41KKbeucV5pgLJ8Cn75pNI 11AWCjW7ZOAMHKDzUomRcCYVxALuHqqB/PswkaU= X-Google-Smtp-Source: ABdhPJzBVJknzhOtHvI7fMIR/xl/Gl13w+9y67HEK0+s5gnd7ae/O5SZ9wgljQXsZbnBtZIrsDU4JfeydOSGGpTO0Yg= X-Received: by 2002:a92:c949:: with SMTP id i9mr104765ilq.19.1628252245325; Fri, 06 Aug 2021 05:17:25 -0700 (PDT) MIME-Version: 1.0 References: <390c6652-0a1f-e8c4-d70d-56ced2f7b0fb@gmail.com> <0ee2488c-04a1-df3b-dd4f-92eec51a4ab2@redhat.com> <7ebb37f3-76c3-8e00-7852-c93bf142043a@gmail.com> <2c60a7d0-3f60-b72f-c0f2-6fc7a4900740@redhat.com> <072a4715-2248-d836-948d-50426160de47@gmail.com> <6ed67ff9-12d3-516a-f7ec-13dd913ed54b@gmail.com> <0bdbdf77-e887-f15a-4b32-0eee6bcf30a9@gmail.com> <3c6631e9-d95c-dbf6-e50e-cee99f8652d7@redhat.com> In-Reply-To: From: Christophe Lyon Date: Fri, 6 Aug 2021 14:17:14 +0200 Message-ID: Subject: Re: [PING][PATCH] define auto_vec copy ctor and assignment (PR 90904) To: Martin Sebor Cc: Jason Merrill , Jonathan Wakely , Richard Biener , gcc-patches , Tamar Christina X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2021 12:17:28 -0000 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::vec(auto_vec&) [with long > unsigned int N = 32ul; > T = std::pair]' > "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 &) = 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::vec(auto_vec&) [with long > unsigned int N = 16ul; > T = std::pair]' > "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 &) = 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 checks = LOOP_VINFO_CHECK_NONZERO (loop_vinfo); >> >>>>> + vec 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 >> >> >> > >> >>