From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id A6903385700A for ; Wed, 10 Mar 2021 11:01:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A6903385700A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rguenther@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 76FE3AE55; Wed, 10 Mar 2021 11:01:43 +0000 (UTC) Date: Wed, 10 Mar 2021 12:01:42 +0100 (CET) From: Richard Biener Sender: rguenther@ryzen.fritz.box To: gcc-patches@gcc.gnu.org cc: polacek@redhat.com Subject: [PATCH] tree-optimization/99510 - fix type reuse of build_aligned_type Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: Wed, 10 Mar 2021 11:01:45 -0000 The fix for PR94775 added more strict checking for type reuse to check_aligned_type, specifically matching TYPE_USER_ALIGN. But then build_aligned_type sets TYPE_USER_ALIGN on the built variant so if the type we build an aligned variant for does not have TYPE_USER_ALIGN we'll never re-use the newly created aligned variant. This results in ~35000 identical variants being created for polyhedron doduc. The following instead checks that the candidate has TYPE_USER_ALIGN set. Bootstrap and regtest running on x86_64-unknown-linux-gnu. 2021-03-10 Richard Biener PR tree-optimization/99510 * tree.c (check_aligned_type): Check that the candidate has TYPE_USER_ALIGN set instead of matching with the original type. --- gcc/tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/tree.c b/gcc/tree.c index 8fa99951df7..7c44c226a33 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -6609,7 +6609,9 @@ check_aligned_type (const_tree cand, const_tree base, unsigned int align) && TYPE_CONTEXT (cand) == TYPE_CONTEXT (base) /* Check alignment. */ && TYPE_ALIGN (cand) == align - && TYPE_USER_ALIGN (cand) == TYPE_USER_ALIGN (base) + /* Check this is a user-aligned type as build_aligned_type + would create. */ + && TYPE_USER_ALIGN (cand) && attribute_list_equal (TYPE_ATTRIBUTES (cand), TYPE_ATTRIBUTES (base)) && check_lang_type (cand, base)); -- 2.26.2