public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Martin Uecker <uecker@tugraz.at>
Cc: Richard Biener <rguenther@suse.de>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] middle-end/114931 - type_hash_canon and structual equality types
Date: Fri, 3 May 2024 21:16:28 +0200	[thread overview]
Message-ID: <ZjU4DFzi2OKQyBqt@tucnak> (raw)
In-Reply-To: <39fcac8a1c61acaaa1c80602b76f48ef73f5f885.camel@tugraz.at>

On Fri, May 03, 2024 at 09:11:20PM +0200, Martin Uecker wrote:
> > TYPE_CANONICAL as used by the middle-end cannot express this but
> 
> Hm. so how does it work now for arrays?

Do you have a testcase which doesn't work correctly with the arrays?

E.g. same_type_for_tbaa has
  type1 = TYPE_MAIN_VARIANT (type1);
  type2 = TYPE_MAIN_VARIANT (type2);

  /* Handle the most common case first.  */
  if (type1 == type2)
    return 1;

  /* If we would have to do structural comparison bail out.  */
  if (TYPE_STRUCTURAL_EQUALITY_P (type1)
      || TYPE_STRUCTURAL_EQUALITY_P (type2))
    return -1;

  /* Compare the canonical types.  */
  if (TYPE_CANONICAL (type1) == TYPE_CANONICAL (type2))
    return 1;

  /* ??? Array types are not properly unified in all cases as we have
     spurious changes in the index types for example.  Removing this
     causes all sorts of problems with the Fortran frontend.  */
  if (TREE_CODE (type1) == ARRAY_TYPE
      && TREE_CODE (type2) == ARRAY_TYPE)
    return -1;
...
and later compares alias sets and the like.
So, even if int[] and int[0] have different TYPE_CANONICAL, they
will be considered maybe the same.  Also, guess get_alias_set
has some ARRAY_TYPE handling...

Anyway, I think we should just go with Richi's patch.

	Jakub


  reply	other threads:[~2024-05-03 19:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-03 12:13 Richard Biener
2024-05-03 15:32 ` Martin Uecker
2024-05-03 16:23   ` Richard Biener
2024-05-03 17:44     ` Martin Uecker
2024-05-03 17:30   ` Jakub Jelinek
2024-05-03 18:04     ` Martin Uecker
2024-05-03 18:18       ` Jakub Jelinek
2024-05-03 18:37         ` Martin Uecker
2024-05-03 18:48           ` Richard Biener
2024-05-03 19:11             ` Martin Uecker
2024-05-03 19:16               ` Jakub Jelinek [this message]
2024-05-04  6:38                 ` Martin Uecker
2024-05-06  7:00                   ` Richard Biener
2024-05-06  7:27                     ` Martin Uecker
2024-05-06  9:07                       ` Richard Biener
2024-05-06 11:20                         ` Martin Uecker
2024-05-07 11:05                           ` Richard Biener

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=ZjU4DFzi2OKQyBqt@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    --cc=uecker@tugraz.at \
    /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).