From: Jan Hubicka <hubicka@ucw.cz>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: Jan Hubicka <hubicka@ucw.cz>,
gcc-patches@gcc.gnu.org,
Richard Biener <richard.guenther@gmail.com>
Subject: Re: Add VIEW_CONVERT_EXPR to operand_equal_p
Date: Thu, 29 Oct 2015 04:35:00 -0000 [thread overview]
Message-ID: <20151029033922.GA52478@kam.mff.cuni.cz> (raw)
In-Reply-To: <2210014.Qgk3pAbeYD@polaris>
> > Added and comitted now.
>
> Thanks. Now on to the wrong code issues. :-)
>
> Up to the change, the useless_type_conversion_p predicate was relying on
> structural equivalence via the TYPE_CANONICAL check, now it only looks at the
> outermost level (size, mode). Now some back-ends, most notably x86-64, do a
> deep structural scan to determine the calling conventions (classify_argument)
> instead of just looking at the size and the mode, so consistency dictates that
> the type of the argument and that of the parameter be structurally equivalent
> and this sometimes can only be achieved by a VCE... which is now deleted. :-(
> See the call to derivedIP in the attached testcase which now fails on x86-64.
>
> How do we get away from here?
Hmm, I noticed this in ipa-icf context and wrote checker that two functions are ABI
compatile (did not pushed it out yet), but of course this is nastier.
I think the problem exists before my patch with LTO - it is just matter of
doing two types which will be considered equivalent by
gimple_canonical_types_compatible_p but have different type conversion. An
example of such type would be:
struct a {
int a[4];
};
struct b {
int a[4];
} __attribute__ ((__aligned__(16)));
I tried to turn this into an testcase, the problem is that I don't know of a way
to obtain VIEW_CONVERT_EXPR between the two types out of C or C++ frontend and we
don't seem to synthetize these in middle end (even in cases it would make sense).
I will try to play with it more - would be nice to have a C reproducer.
We may be safe before my patch from wrong code issues if there is no way to
rpduce VIEW_CONVERT_EXPR between types like this in languages that support
aligned attribute.
I think the problem is generally similar to memory references - the gimple type
compatibility should not be tied to ABI details. Probably most consistent
solution would be to extend GIMPLE_CALL to also list types of parameters and do
not rely on whatever type the operand have....
Richard, any ideas?
Honza
>
>
> * gnat.dg/discr44.adb: New test.
>
> --
> Eric Botcazou
> -- { dg-do run }
> -- { dg-options "-gnatws" }
>
> procedure Discr44 is
>
> function Ident (I : Integer) return Integer is
> begin
> return I;
> end;
>
> type Int is range 1 .. 10;
>
> type Str is array (Int range <>) of Character;
>
> type Parent (D1, D2 : Int; B : Boolean) is record
> S : Str (D1 .. D2);
> end record;
>
> type Derived (D : Int) is new Parent (D1 => D, D2 => D, B => False);
>
> X1 : Derived (D => Int (Ident (7)));
>
> begin
> if X1.D /= 7 then
> raise Program_Error;
> end if;
> end;
next prev parent reply other threads:[~2015-10-29 3:39 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-14 16:29 Jan Hubicka
2015-10-15 8:39 ` Richard Biener
2015-10-15 11:22 ` Eric Botcazou
2015-10-15 19:47 ` Eric Botcazou
2015-10-15 23:24 ` Jan Hubicka
2015-10-16 15:58 ` Eric Botcazou
2015-10-16 21:47 ` Richard Biener
2015-10-17 10:27 ` Eric Botcazou
2015-10-17 15:17 ` Richard Biener
2015-10-17 18:57 ` Jan Hubicka
2015-10-18 12:57 ` Eric Botcazou
2015-10-18 16:37 ` Jan Hubicka
2015-10-18 17:14 ` Richard Biener
2015-10-18 18:45 ` Jan Hubicka
2015-10-19 12:31 ` Richard Biener
2015-10-19 21:01 ` Jan Hubicka
2015-10-19 8:17 ` Eric Botcazou
2015-10-19 7:58 ` Eric Botcazou
2015-10-19 19:46 ` Jan Hubicka
2015-10-20 7:02 ` Eric Botcazou
2015-10-21 22:22 ` Jan Hubicka
2015-10-22 8:52 ` Andreas Schwab
2015-10-28 22:49 ` Eric Botcazou
2015-10-29 4:35 ` Jan Hubicka [this message]
2015-10-29 11:31 ` Richard Biener
2015-10-29 11:32 ` Richard Biener
2015-10-29 11:32 ` Richard Biener
2015-11-04 8:51 ` Eric Botcazou
2015-10-29 15:06 ` Jan Hubicka
2015-10-29 15:24 ` Richard Biener
2015-10-29 15:53 ` Jan Hubicka
2015-10-30 8:57 ` Richard Biener
2015-10-30 15:28 ` Jan Hubicka
2015-11-02 9:55 ` Richard Biener
2015-10-30 9:56 ` Eric Botcazou
2015-10-30 15:19 ` Jan Hubicka
2015-10-31 17:39 ` Eric Botcazou
2015-10-31 17:58 ` Richard Biener
2015-11-03 10:26 ` Eric Botcazou
2015-11-03 11:39 ` Richard Biener
2015-11-02 9:30 ` Andreas Schwab
2015-11-03 8:43 ` Eric Botcazou
2015-11-04 7:23 ` Jan Hubicka
2015-11-04 8:20 ` Eric Botcazou
2015-11-04 16:50 ` Jan Hubicka
2015-11-05 13:49 ` Richard Biener
2015-10-21 4:42 ` Jan Hubicka
2015-10-21 8:54 ` Richard Biener
2015-10-21 11:24 ` Eric Botcazou
2015-10-23 5:22 ` Jan Hubicka
2015-10-23 9:14 ` Richard Biener
2015-10-15 16:59 ` 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=20151029033922.GA52478@kam.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.guenther@gmail.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).