Message ID | ZRaRXvGWkoPufmly@tucnak |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3878038vqu; Fri, 29 Sep 2023 01:57:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHbR35a81CoWC510YyTsdWsJK4Erfp02KE8Mf6Xin+SgzuHJ7T/IStACR7VhLF9PemRKgH4 X-Received: by 2002:aa7:dac3:0:b0:532:b974:671e with SMTP id x3-20020aa7dac3000000b00532b974671emr3115667eds.41.1695977863570; Fri, 29 Sep 2023 01:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695977863; cv=none; d=google.com; s=arc-20160816; b=SzRvDEgVoOef3iVu/C7rK3X35ac/cYWisdeTfykI4R7XQR6OxlvjSZK8eczTtKqyqn CIxBf0TOWwFhEFkAaCWDhUHzpOI3H6X91Xg74jnEPTPltoWjjZeUwWBDwj6FmEk2FEn7 rt/QqdbFvNbOU0aplpFLVlqXEy+YWsyXDpIjvoTLeCg52eGIep2b2SdfzO9+dLiws1hS gVLVTZ0x2toapokG9hviG7J7WXxvsdVhSvuXS6mjhuNr8aIl7gMzKmUlEcYN4XdNiKwb EHGKRKXS9CK6gFn/atrxwPVRX6L0wB292t9eHDhdC54+MLFHgcP/7e6h3e/WOcmV++MU VUkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition:in-reply-to :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dmarc-filter:delivered-to; bh=AiDCeKZTsNRlm5S+TJywaY8nZF8uLFLAuiCi+tkdI/Q=; fh=SG8GkQakHrGPM5maY5554u68cM+3E1K6qxfpSNoiWE4=; b=vSdQYJg7GED8agSFSnnHZSBHJY9O6JmLujhWt27M0Zj1gE1cnpHw0QEgFeOVFe0FO/ In9ggWhictMuhkBs8zT34BNHUUYJV5W5jCXBvgSP4RKrFlncCy97ERxz1IEYYq2Q089A PnqkWspcA2tQ4yW2m0X4NP6EbSPEOQ9QmpSZ6JDHyxpxc7l1nScAifspHzNZI7YYDvyZ nVaVIjmomMIz/IFjxWvzWrFIRGWoRWBrZm6YH1RZjBKhGbqxqsYH/7Nrj6g0YorrYdw1 KVMIwrrjm1LhJExkYqjcvdiRXhv4nGQAEXkbhhpG2/7+z0rMoVZZws7TxzDOSr1D0Pq8 0iRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Fm/I3Y5O"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id i6-20020aa7c706000000b005256af07b3bsi15046327edq.541.2023.09.29.01.57.43 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 01:57:43 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Fm/I3Y5O"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D957138618CB for <ouuuleilei@gmail.com>; Fri, 29 Sep 2023 08:57:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 16A9E3858C01 for <gcc-patches@gcc.gnu.org>; Fri, 29 Sep 2023 08:57:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 16A9E3858C01 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695977831; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=AiDCeKZTsNRlm5S+TJywaY8nZF8uLFLAuiCi+tkdI/Q=; b=Fm/I3Y5O4nJJfZKHskMXbBa2QZrqWXFinKDz65x6BWMDEr0pAM4W6cs67CMcD1YDyPoVj2 pUR9rokskvSbLgX8B1z7cVY6qFX8j34xMxhtwUt2J86buCWtGocaBzESDQr7ZJO2z8LxWp 3P6MX+fVaSWxtx771sjc1ZyPSu0WS6Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-258-0sQfIkQoNHuDoh_o5Xc8IQ-1; Fri, 29 Sep 2023 04:57:07 -0400 X-MC-Unique: 0sQfIkQoNHuDoh_o5Xc8IQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 59F2D8015AB; Fri, 29 Sep 2023 08:57:07 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.202]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ED5D740C6EBF; Fri, 29 Sep 2023 08:57:06 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 38T8v3Ka991502 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 29 Sep 2023 10:57:04 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 38T8v2Bj991501; Fri, 29 Sep 2023 10:57:02 +0200 Date: Fri, 29 Sep 2023 10:57:02 +0200 From: Jakub Jelinek <jakub@redhat.com> To: Richard Biener <rguenther@suse.de> Cc: Jonathan Wakely <jwakely@redhat.com>, Richard Sandiford <richard.sandiford@arm.com>, gcc-patches@gcc.gnu.org Subject: [PATCH] use *_grow_cleared rather than *_grow on vect_unpromoted_value Message-ID: <ZRaRXvGWkoPufmly@tucnak> References: <ZRO3oQPNmFYPAxJC@tucnak> <nycvar.YFH.7.77.849.2309270716100.5561@jbgna.fhfr.qr> <ZRQIE2SvOgO6S5WF@tucnak> <nycvar.YFH.7.77.849.2309271105110.5561@jbgna.fhfr.qr> MIME-Version: 1.0 In-Reply-To: <nycvar.YFH.7.77.849.2309271105110.5561@jbgna.fhfr.qr> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="ePpvagVeE6DUqZZa" Content-Disposition: inline X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778361683934641441 X-GMAIL-MSGID: 1778361683934641441 |
Series |
use *_grow_cleared rather than *_grow on vect_unpromoted_value
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jakub Jelinek
Sept. 29, 2023, 8:57 a.m. UTC
On Wed, Sep 27, 2023 at 11:15:26AM +0000, Richard Biener wrote: > > tree-vect-patterns.cc:2947 unprom.quick_grow (nops); > > T = vect_unpromoted_value > > Go for quick_grow_cleared? Something else? > > The CTOR zero-initializes everything, so maybe it can go. In theory > .set_op could also be changed to .push_op ... So, I had a look at this and I think using quick_grow_cleared is best choice here. The nops is 2 or 1 most of the time, worst case 3, so the price of extra initialization of 4 pointer-sized-or-less members times 1, 2 or 3 doesn't seem worth bothering, it is similar to the bitmap_head case where we already pay the price for just one structure anytime we do vect_unpromoted_value unprom_diff; (and later set_op on it) or even vect_unpromoted_value unprom0[2]; With this patch and Richard S's poly_int_pod removal the static_assert can be enabled as well and gcc builds. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? The second patch waits for the poly_int_pod removal commit and has been just build tested but not bootstrapped yet. 2023-09-29 Jakub Jelinek <jakub@redhat.com> * tree-vect-patterns.cc (vect_recog_over_widening_pattern): Use quick_grow_cleared method on unprom rather than quick_grow. Jakub 2023-09-29 Jakub Jelinek <jakub@redhat.com> * vec.h (quick_grow): Uncomment static_assert. --- gcc/vec.h.jj 2023-09-29 10:39:09.327223861 +0200 +++ gcc/vec.h 2023-09-29 10:44:03.764108443 +0200 @@ -1396,7 +1396,7 @@ inline void vec<T, A, vl_embed>::quick_grow (unsigned len) { gcc_checking_assert (length () <= len && len <= m_vecpfx.m_alloc); -// static_assert (std::is_trivially_default_constructible <T>::value, ""); + static_assert (std::is_trivially_default_constructible <T>::value, ""); m_vecpfx.m_num = len; }
Comments
On Fri, 29 Sep 2023, Jakub Jelinek wrote: > On Wed, Sep 27, 2023 at 11:15:26AM +0000, Richard Biener wrote: > > > tree-vect-patterns.cc:2947 unprom.quick_grow (nops); > > > T = vect_unpromoted_value > > > Go for quick_grow_cleared? Something else? > > > > The CTOR zero-initializes everything, so maybe it can go. In theory > > .set_op could also be changed to .push_op ... > > So, I had a look at this and I think using quick_grow_cleared is best choice > here. The nops is 2 or 1 most of the time, worst case 3, so the price of > extra initialization of 4 pointer-sized-or-less members times 1, 2 or 3 > doesn't seem worth bothering, it is similar to the bitmap_head case where > we already pay the price for just one structure anytime we do > vect_unpromoted_value unprom_diff; > (and later set_op on it) or even > vect_unpromoted_value unprom0[2]; > > With this patch and Richard S's poly_int_pod removal the static_assert can > be enabled as well and gcc builds. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? OK. > The second patch waits for the poly_int_pod removal commit and has been just > build tested but not bootstrapped yet. > > 2023-09-29 Jakub Jelinek <jakub@redhat.com> > > * tree-vect-patterns.cc (vect_recog_over_widening_pattern): Use > quick_grow_cleared method on unprom rather than quick_grow. > > --- gcc/tree-vect-patterns.cc.jj 2023-08-24 15:37:29.321410276 +0200 > +++ gcc/tree-vect-patterns.cc 2023-09-29 09:45:27.980168865 +0200 > @@ -2944,7 +2944,7 @@ vect_recog_over_widening_pattern (vec_in > /* Check the operands. */ > unsigned int nops = gimple_num_ops (last_stmt) - first_op; > auto_vec <vect_unpromoted_value, 3> unprom (nops); > - unprom.quick_grow (nops); > + unprom.quick_grow_cleared (nops); > unsigned int min_precision = 0; > bool single_use_p = false; > for (unsigned int i = 0; i < nops; ++i) > > > Jakub >
--- gcc/tree-vect-patterns.cc.jj 2023-08-24 15:37:29.321410276 +0200 +++ gcc/tree-vect-patterns.cc 2023-09-29 09:45:27.980168865 +0200 @@ -2944,7 +2944,7 @@ vect_recog_over_widening_pattern (vec_in /* Check the operands. */ unsigned int nops = gimple_num_ops (last_stmt) - first_op; auto_vec <vect_unpromoted_value, 3> unprom (nops); - unprom.quick_grow (nops); + unprom.quick_grow_cleared (nops); unsigned int min_precision = 0; bool single_use_p = false; for (unsigned int i = 0; i < nops; ++i)