From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 3A808385115B; Fri, 28 Oct 2022 13:46:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3A808385115B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 36D741F984; Fri, 28 Oct 2022 13:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1666964808; h=from:from:reply-to: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=md3+6VDvbOftXgs1Xn/eZ6dZufW0Xndg0SVS1XgRXu4=; b=SunqHZcep3YFUCv2e/5W1gFoKTSxClGvxaJP/NZ+TMhCARbyopzpGuxH1aIPKOD24y3Yk4 nQKI9g0o8oWLP1I1b8aWHp5EmZBjQEOvSagkHZQyRkbSZ1dxDtkeQ+HGmnnAlXg5TDqure cK7epFaiQ6L0/u2Sek13ETY1pDzeb+g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1666964808; h=from:from:reply-to: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=md3+6VDvbOftXgs1Xn/eZ6dZufW0Xndg0SVS1XgRXu4=; b=AF+DxADotmbzgaYD5nBWLDQLluAxu/8BrOE6qoATSmGxjjm/sSOoL8T2CLIBFExeuu7U06 yl5CBaVVl3o/iDBw== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 2E4C72C141; Fri, 28 Oct 2022 13:46:48 +0000 (UTC) Date: Fri, 28 Oct 2022 13:46:48 +0000 (UTC) From: Richard Biener To: "Andre Vieira (lists)" cc: "gcc-patches@gcc.gnu.org" , Richard Sandiford , ebotcazou@gcc.gnu.org Subject: Re: vect: Make vect_check_gather_scatter reject offsets that aren't multiples of BITS_PER_UNIT [PR107346] In-Reply-To: <0f38765b-3ca1-aee5-359e-ae10dd418433@arm.com> Message-ID: References: <129db1b0-0d2a-b768-bc80-9f73d665e8f8@arm.com> <3cc86b91-eef3-7def-7b3b-464c58369f4b@arm.com> <0f38765b-3ca1-aee5-359e-ae10dd418433@arm.com> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1609957120-494698720-1666964808=:4294" X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,SPF_HELO_NONE,SPF_PASS,TXREP 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: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1609957120-494698720-1666964808=:4294 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Fri, 28 Oct 2022, Andre Vieira (lists) wrote: > > On 24/10/2022 14:29, Richard Biener wrote: > > On Mon, 24 Oct 2022, Andre Vieira (lists) wrote: > > > >> Changing if-convert would merely change this testcase but we could still > >> trigger using a different structure type, changing the size of Int24 to 32 > >> bits rather than 24: > >> package Loop_Optimization23_Pkg is > >>   type Nibble is mod 2**4; > >>   type Int24  is mod 2**32;  -- Changed this from 24->32 > >>   type StructA is record > >>     a : Nibble; > >>     b : Int24; > >>   end record; > >>   pragma Pack(StructA); > >>   type StructB is record > >>     a : Nibble; > >>     b : StructA; > >>   end record; > >>   pragma Pack(StructB); > >>   type ArrayOfStructB is array(0..100) of StructB; > >>   procedure Foo (X : in out ArrayOfStructB); > >> end Loop_Optimization23_Pkg; > >> > >> This would yield a DR_REF (dr): (*x_7(D))[_1].b.b  where the last 'b' isn't > >> a > >> DECL_BIT_FIELD anymore, but the first one still is and still has the > >> non-multiple of BITS_PER_UNIT offset. Thus passing the > >> vect_find_stmt_data_reference check and triggering the > >> vect_check_gather_scatter failure. So unless we go and make sure we always > >> set > >> the DECL_BIT_FIELD on all subsequent accesses of a DECL_BIT_FIELD 'struct' > >> (which is odd enough on its own) then we are better off catching the issue > >> in > >> vect_check_gather_scatter ? > > But it's not only an issue with scatter-gather, other load/store handling > > assumes it can create a pointer to the start of the access and thus > > requires BITS_PER_UNIT alignment for each of them. So we need to fail > > at data-ref analysis somehow. > > > > Richard. > > Sorry for the delay on this, had some other things come in between. After our > IRC discussion I believe we agreed that it would be neater to check this in > vect_check_gather_scatter as I did in the original patch in > https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604139.html > The main reasons being that to check earlier we'd need to walk the DR_REF to > look for any FIELD_DECL that has DECL_BIT_FIELD set and we decided against > that. > > Can you confirm the original patch is OK for trunk? Yes. Thanks, Richard. > Kind regards, > Andre ---1609957120-494698720-1666964808=:4294--