public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: "David Čepelík" <d@dcepelik.cz>
Cc: gcc-patches@gcc.gnu.org, rguenther@suse.de, tobias@codesourcery.com
Subject: Re: New modref/ipa_modref optimization passes
Date: Thu, 29 Oct 2020 16:14:48 +0100	[thread overview]
Message-ID: <20201029151448.GB50167@kam.mff.cuni.cz> (raw)
In-Reply-To: <20200920061551.GA29500@kam.mff.cuni.cz>

> 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?

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"
 \f
 
 #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)

  parent reply	other threads:[~2020-10-29 15:14 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-16 22:23 David Čepelík
2020-09-19 22:32 ` Jan Hubicka
2020-09-20  6:15   ` Jan Hubicka
2020-09-21  7:13     ` Richard Biener
2020-09-21  7:47       ` Jan Hubicka
2020-09-21  7:55         ` Richard Biener
2020-09-21  8:04           ` Jan Hubicka
2020-09-21  8:10             ` Richard Biener
2020-09-22 10:15               ` Tobias Burnus
2020-09-27 21:37                 ` Jan Hubicka
2020-10-16  7:56                   ` Jan Hubicka
2020-10-16  8:05                     ` Richard Biener
2020-10-16  9:20                       ` Richard Biener
2020-10-16 10:42                         ` Richard Biener
2020-10-23  9:54                         ` Bernhard Reutner-Fischer
2020-10-23 10:05                           ` Andre Vehreschild
2020-10-29 15:14     ` Jan Hubicka [this message]
2020-10-30  8:16       ` Richard Biener
2020-09-20 14:33   ` David Malcolm
2020-09-20 17:30     ` Jan Hubicka
2020-09-20 23:27       ` David Malcolm
2020-09-22 18:47         ` Jan Hubicka
2020-09-22 20:19           ` Jan Hubicka
2020-09-21 23:14       ` David Malcolm
2020-09-22  6:45         ` Jan Hubicka
2020-09-22  7:07           ` Jan Hubicka
2020-09-22 11:21             ` David Malcolm
2020-09-22 12:29               ` Jan Hubicka
2020-09-22 18:39               ` Jan Hubicka
2020-09-22 20:13                 ` David Malcolm
2020-09-22 20:21                   ` David Malcolm
2020-09-22 20:24                     ` Jan Hubicka
2020-09-22 20:47                       ` Issue with ggc_delete and finalizers (was Re: New modref/ipa_modref optimization passes) David Malcolm
2020-09-23  8:31                         ` Jan Hubicka
2020-09-24  6:30                         ` Jan Hubicka
2020-09-25 14:42                           ` David Malcolm
2020-09-22 20:23                   ` New modref/ipa_modref optimization passes Jan Hubicka
2020-09-22 21:17                     ` David Malcolm
2020-09-22  8:13   ` [committed] ipa: Fix up ipa modref option help texts Jakub Jelinek
2020-09-22  8:47     ` Jakub Jelinek
2020-09-22  9:12       ` Jan Hubicka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201029151448.GB50167@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=d@dcepelik.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    --cc=tobias@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).