From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 ; 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 To: Richard Biener Cc: Jonathan Wakely , Richard Sandiford , gcc-patches@gcc.gnu.org Subject: [PATCH] use *_grow_cleared rather than *_grow on vect_unpromoted_value Message-ID: Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: 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 List-Id: --ePpvagVeE6DUqZZa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 * 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 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 --ePpvagVeE6DUqZZa Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=Q017 2023-09-29 Jakub Jelinek * 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::quick_grow (unsigned len) { gcc_checking_assert (length () <= len && len <= m_vecpfx.m_alloc); -// static_assert (std::is_trivially_default_constructible ::value, ""); + static_assert (std::is_trivially_default_constructible ::value, ""); m_vecpfx.m_num = len; } --ePpvagVeE6DUqZZa--