public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: "Jeff Law" <law@redhat.com>, "Martin Liška" <mliska@suse.cz>,
	"Marek Polacek" <polacek@redhat.com>,
	"GCC Patches" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix PR ipa/65318
Date: Fri, 06 Mar 2015 12:04:00 -0000	[thread overview]
Message-ID: <CAFiYyc1pxEsymWE-Dj4Oes=pROtnpOW2R_yy7UVHBs9FgctB2A@mail.gmail.com> (raw)
In-Reply-To: <20150305183835.GC87243@kam.mff.cuni.cz>

On Thu, Mar 5, 2015 at 7:38 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> >Index: gimple-fold.c
>> >===================================================================
>> >--- gimple-fold.c    (revision 221170)
>> >+++ gimple-fold.c    (working copy)
>> >@@ -263,7 +263,16 @@ get_symbol_constant_value (tree sym)
>> >     {
>> >       val = canonicalize_constructor_val (unshare_expr (val), sym);
>> >       if (val && is_gimple_min_invariant (val))
>> >-        return val;
>> >+        {
>> >+              if (!useless_type_conversion_p (TREE_TYPE (sym),
>> >TREE_TYPE (val)))
>> >+            {
>> >+              if (operand_equal_p (TYPE_SIZE (TREE_TYPE (sym)),
>> >+                                   TYPE_SIZE (TREE_TYPE (val)), 0))
>> >+                return NULL_TREE;
>>
>> And no, I don't think this is sane.  Callers need to handle mismatches IIRC.
>
> OK, I am little bit confused about your MEM_REF suggestion. So you mean that
> MEM_REF should be added around all references to symbol that is an alias?
> Where it is done?  Is there a reason why we do not add MEM_REF always?  I would
> like to keep optimization passes (like ipa-visibility or ICF) to turn symbol
> into an alias without having to update underlying IL.

Yes - but I said that having an alias should have the same effect as
the MEM_REF wrapping we do in LTO (to not barf on stmt verification
if symbol merging merges an int and a float for example).

>
> Concerning callers handling mismatches, the VIEW_CONVERT_EXPR thing seems valid
> thing to do for all uses except for fold_const_aggregate_ref_1. So perhaps
> we can just inline rest of get_symbol_constant_value in there and document that
> get_symbol_constant_value returns value in correct type.
>
> Or am I missing something obvious?

Yeah, that looks good.  Note that we can as well change all callers
of get_symbol_constant_value to use fold_const_aggregate_ref, no?
So reduce the number of APIs.

Richard.

>
> Thanks!
> Honza
>>
>> >+              val = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (sym), val);
>> >+            }
>> >+          return val;
>> >+        }
>> >       else
>> >         return NULL_TREE;
>> >     }
>>

  reply	other threads:[~2015-03-06 12:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-05 13:54 Martin Liška
2015-03-05 14:29 ` Marek Polacek
2015-03-05 14:37   ` Martin Liška
2015-03-05 16:15     ` Jeff Law
2015-03-05 18:08       ` Jan Hubicka
2015-03-05 18:26         ` Richard Biener
2015-03-05 18:27         ` Richard Biener
2015-03-05 18:38           ` Jan Hubicka
2015-03-06 12:04             ` Richard Biener [this message]
2015-03-06 15:39               ` Jan Hubicka
2015-03-05 17:23     ` Jan Hubicka
2015-03-05 17:24       ` 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='CAFiYyc1pxEsymWE-Dj4Oes=pROtnpOW2R_yy7UVHBs9FgctB2A@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=law@redhat.com \
    --cc=mliska@suse.cz \
    --cc=polacek@redhat.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).