From: Eric Botcazou <ebotcazou@adacore.com>
To: Richard Guenther <rguenther@suse.de>
Cc: gcc@gcc.gnu.org
Subject: Re: On VIEW_CONVERT_EXPRs and TBAA
Date: Sat, 26 Sep 2009 20:41:00 -0000 [thread overview]
Message-ID: <200909262226.36100.ebotcazou@adacore.com> (raw)
In-Reply-To: <alpine.LNX.2.00.0909241235130.4520@zhemvz.fhfr.qr>
> With VIEW_CONVERT_EXPR you can also easily create the situation
> where for a reference tree, let it be VIEW_CONVERT_EXPR <T2> (X.a).b
> like commonly seen in Ada, the alias-set of the outermost component
> is not a subset of that of the innermost one (the relationship that
> is usually assured to be true by the record_component_aliases
> machinery). You are probably safe here if only your frontend generates
> such conversions and it is very consistent on how it balances
> V_C_Es with accesses through pointers (because in the above case
> if .b is an addressable component an access via a pointer to type
> of b wouldn't necessarily alias the cited reference tree).
I presume you're talking exclusively about the addressable case here, because
in Ada the alias set of (the type of) the outermost component is not a subset
of (that of) the innermost one by default (at least for scalar types, it is
for aggregate types because of implementation limitations), there being a VCE
or not; the field must explicitly be declared addressable.
> So, what I'd like to know is in which circumstances the Ada
> frontend uses VIEW_CONVERT_EXPRs and what counter-measures it
> applies to ensure consistent TBAA.
The Ada compiler generates a lot of VIEW_CONVERT_EXPRs for conversions between
aggregate (sub)types because it generates a lot of aggregate subtypes from a
given aggregate type. These conversions are purely formal and their purpose
is to ensure type consistency. The Ada compiler also uses VIEW_CONVERT_EXPR
to implement up-casting
type Base is tagged record
I : Integer;
end record;
type Derived is new Base with record
J : Integer;
end record;
D : Derived;
Base (D).I
is translated into VIEW_CONVERT_EXPR<base>(d).i (a questionable use of VCE, no
doubt about that). There are a few other, more obscur uses, but we get rid
of the most controversial one (optimization barrier on scalars for VRP).
The main countermeasure to ensure consistent TBAA is decl.c:relate_alias_sets
which is aimed at doing the right thing when types are VCEd to each other.
--
Eric Botcazou
next prev parent reply other threads:[~2009-09-26 20:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-24 10:53 Richard Guenther
2009-09-26 20:41 ` Eric Botcazou [this message]
2009-09-26 22:24 ` Richard Guenther
2009-09-27 9:40 ` Eric Botcazou
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=200909262226.36100.ebotcazou@adacore.com \
--to=ebotcazou@adacore.com \
--cc=gcc@gcc.gnu.org \
--cc=rguenther@suse.de \
/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).