public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org, d@dcepelik.cz
Subject: Re: Make nonoverlapping_component_refs work with duplicated main variants
Date: Tue, 09 Jul 2019 13:10:00 -0000	[thread overview]
Message-ID: <20190709130724.5lnqywgf7xxmlny4@kam.mff.cuni.cz> (raw)
In-Reply-To: <alpine.LSU.2.20.1907091433020.2976@zhemvz.fhfr.qr>

> > tree_int_cst_equal will return false if offsets are not INTEGER_CST.
> > I was not sure if I can safely use operand_equal_p.  What happens for
> > fields with variable offsets when I inline two copies of same function
> > which takes size as parameter and make the size different? Will I get
> > here proper SSA name so operand_equal_p will work?
> 
> No, you get a DECL, but yes, I think operand_equal_p will work.
> Consider two _same_ variable sizes, you'll not see that you
> have to return zero then?  But yes, in case you have types
> globbed to the canonical type (but not FIELD_DECLs) then
> you'll get false !operand_equal_p as well.
> 
> The question is really what is desired here.  If you want/need precision
> for non-constant offsets then you have to look at the COMPONENT_REF
> trees because the relevant offset (SSA name) is only there
> (in TREE_OPERAND (component_ref, 2)).
> 
> If you want to give up for non-constants and can do that without
> correctness issue then fine (but Ada probably would like to have
> it - so also never forget to include Ada in testing here ;))

I would like to have precision here. so perhaps as incremental change I
can
 1) reorganize callers to pass refs rather than just field_decls
 2) check if TREE_OPERAND (component_ref, 2) is non-NULL in both case
    a) if so do operand_equal_p on them and return 0 on match
    b) if there is no match see if I have same canonical types and
       return 1 then
    c) return -1 otherwise
 3) continue with parsing FIELD_DECLS we work on now.
> 
> Oh, OK ... a bit more explaining commentary might be nice
> (at the top of the function - basically what the input
> constraints to the FIELD_DECLs are).

OK, will try to improve comments (though i tried to be relatively
thorough).

Honza
> 
> Btw, the offsets in FIELD_DECLs are relative to DECL_CONTEXT so
> comparing when DECL_CONTEXT are not related at all doesn't make
> any sense.  Well, unless we know _those_ are at the same offset,
> so - the constraint for the FIELD_DECLs we compare is that
> the containing structure type object instances live at the same
> address?
> 
> Richard.

  reply	other threads:[~2019-07-09 13:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08  7:39 Jan Hubicka
2019-07-08  9:10 ` Richard Biener
2019-07-08 10:48   ` Jan Hubicka
2019-07-09 12:02   ` Jan Hubicka
2019-07-09 12:21     ` Richard Biener
2019-07-09 12:41       ` Jan Hubicka
2019-07-09 12:52         ` Richard Biener
2019-07-09 13:10           ` Jan Hubicka [this message]
2019-07-09 13:30             ` Richard Biener
2019-07-09 13:37       ` Jan Hubicka
2019-07-09 13:41         ` Richard Biener
2019-07-09 21:03           ` Bernhard Reutner-Fischer
2019-07-11  8:29     ` Rainer Orth
2019-07-16  9:30       ` Jan Hubicka
2019-07-16 11:58         ` Rainer Orth

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=20190709130724.5lnqywgf7xxmlny4@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=d@dcepelik.cz \
    --cc=gcc-patches@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).