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 E7319385E444 for ; Fri, 30 Oct 2020 08:16:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E7319385E444 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 CA8DFAD09; Fri, 30 Oct 2020 08:16:21 +0000 (UTC) Date: Fri, 30 Oct 2020 09:16:21 +0100 (CET) From: Richard Biener Sender: rguenther@c653.arch.suse.de To: Jan Hubicka cc: =?ISO-8859-2?Q?David_=C8epel=EDk?= , gcc-patches@gcc.gnu.org, tobias@codesourcery.com Subject: Re: New modref/ipa_modref optimization passes In-Reply-To: <20201029151448.GB50167@kam.mff.cuni.cz> Message-ID: References: <157394261677.27454.2367573047582814412@a285.localdomain> <20200919223255.GA69342@kam.mff.cuni.cz> <20200920061551.GA29500@kam.mff.cuni.cz> <20201029151448.GB50167@kam.mff.cuni.cz> 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.2 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: Fri, 30 Oct 2020 08:16:24 -0000 On Thu, 29 Oct 2020, Jan Hubicka wrote: > > Hi, > > this is patch I am using to fix the assumed_alias_type.f90 failure by > > simply arranging alias set 0 for the problematic array descriptor. > > > > I am not sure this is the best option, but I suppose it is better than > > setting all array descritors to have same canonical type (as done by > > LTO)? > > > Hi, > here is updated patch which used TYPELESS_STORAGE instead of alias set > 0, so it is LTO safe. Unforunately I also had to enable it for all > array descriptors otherwise I still get misopitmizations with modref > extended to handle bulitins, for example: > > FAIL: gfortran.dg/class_array_20.f03 -Os execution test > FAIL: gfortran.dg/coindexed_1.f90 -O2 execution test > FAIL: gfortran.dg/coindexed_1.f90 -O3 -fomit-frame-pointer > FAIL: gfortran.dg/coindexed_1.f90 -O3 -g execution test > > This is not a perfect solution (we really want to track array > descriptors), but it fixes wrong code and would let me to move forward. > Is it OK for mainline? > > With extended modref I still get infinite loop on pdt_14 testcase. > ipa-modref only performs disambiguation on > __vtab_link_module_Pdtlink_8._deallocate this global variable is > readonly (and is detected as such with LTO) so it must be just > uncovering some latent problem there. I am however not familiar enough > with Fortran to tell what is wrong there. > > The testcase fail different way with -flto for me. > > Bootstrapped/regtested x86_64-linux, OK? OK. Thanks, Richard. > Honza > > * trans-types.c: Include alias.h > (gfc_get_array_type_bounds): Set typeless storage. > diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c > index b15ea667411..b7129dcbe6d 100644 > --- a/gcc/fortran/trans-types.c > +++ b/gcc/fortran/trans-types.c > @@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see > #include "trans-array.h" > #include "dwarf2out.h" /* For struct array_descr_info. */ > #include "attribs.h" > +#include "alias.h" > > > #if (GFC_MAX_DIMENSIONS < 10) > @@ -1903,6 +1904,10 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound, > base_type = gfc_get_array_descriptor_base (dimen, codimen, false); > TYPE_CANONICAL (fat_type) = base_type; > TYPE_STUB_DECL (fat_type) = TYPE_STUB_DECL (base_type); > + /* Arrays of unknown type must alias with all array descriptors. */ > + TYPE_TYPELESS_STORAGE (base_type) = 1; > + TYPE_TYPELESS_STORAGE (fat_type) = 1; > + gcc_checking_assert (!get_alias_set (base_type) && !get_alias_set (fat_type)); > > tmp = TYPE_NAME (etype); > if (tmp && TREE_CODE (tmp) == TYPE_DECL) >