public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: Bernd Schmidt <bschmidt@redhat.com>,
	Eric Botcazou <ebotcazou@adacore.com>,
	    gcc-patches@gcc.gnu.org, law@redhat.com
Subject: Re: Do not use TYPE_CANONICAL in useless_type_conversion
Date: Tue, 06 Oct 2015 11:18:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.11.1510061304480.6516@zhemvz.fhfr.qr> (raw)
In-Reply-To: <20151005153458.GB9972@kam.mff.cuni.cz>

On Mon, 5 Oct 2015, Jan Hubicka wrote:

> > >+  /* For aggregates compare only the size and mode.  Accesses to fields do have
> > >+     a type information by themselves and thus we only care if we can i.e.
> > >+     use the types in move operations.  */
> > >    else if (AGGREGATE_TYPE_P (inner_type)
> > >  	   && TREE_CODE (inner_type) == TREE_CODE (outer_type))
> > >-    return false;
> > >+    return (!TYPE_SIZE (outer_type)
> > >+	    || (TYPE_SIZE (inner_type)
> > >+		&& operand_equal_p (TYPE_SIZE (inner_type),
> > >+				    TYPE_SIZE (outer_type), 0)));
> > >+
> > >+  else if (TREE_CODE (inner_type) == OFFSET_TYPE
> > >+	   && TREE_CODE (inner_type) == TREE_CODE (outer_type))
> > >+    return useless_type_conversion_p (TREE_TYPE (outer_type),
> > >+				      TREE_TYPE (inner_type))
> > >+	   && useless_type_conversion_p
> > >+	        (TYPE_OFFSET_BASETYPE (outer_type),
> > >+		 TYPE_OFFSET_BASETYPE (inner_type));
> > >
> > 
> > The comment says the mode is compared, but I don't see that in the
> > code. Which is right?

The comment is wrong.

> > Also, wouldn't the final condition be clearer written as
> > 
> > > +  else if (TREE_CODE (inner_type) == OFFSET_TYPE
> > > +	   && TREE_CODE (outer_type) == OFFSET_TYPE)
> 
> Updated in my local copy, thanks!

The patch works for me but I'm not sure about the store_expr_with_bounds
change.  Where does the actual copying take place?  adjust_address_nv
just adjusts the mode ...

Index: gcc/expr.c
===================================================================
--- gcc/expr.c  (revision 228514)
+++ gcc/expr.c  (working copy)
@@ -5462,7 +5462,7 @@ store_expr_with_bounds (tree exp, rtx ta
     {
       if (GET_MODE (temp) != GET_MODE (target) && GET_MODE (temp) != 
VOIDmode)
        {
-         if (GET_MODE (target) == BLKmode)
+         if (GET_MODE (target) == BLKmode || MEM_P (target))
            {
              /* Handle calls that return BLKmode values in registers.  */
              if (REG_P (temp) && TREE_CODE (exp) == CALL_EXPR)

works for me as well (for the testcase that ICEd for you) and it
definitely will emit the copy.  Basically if it is a MEM the mode
should be irrelevant (do we have BLKmode things that are _not_ MEMs?).

Anyway, your expr.c hunk looks wrong (no copy) and I'll let somebody
more familiar with that area do the sort-out.  Unfortunately
that ICEing testcase isn't a runtime one ;)

Richard.

  reply	other threads:[~2015-10-06 11:18 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 22:11 Jan Hubicka
2015-10-01  8:33 ` Richard Biener
2015-10-01 17:51   ` Jan Hubicka
2015-10-02  7:45     ` Richard Biener
2015-10-02  6:43   ` Jan Hubicka
2015-10-02  7:56     ` Richard Biener
2015-10-02 16:02       ` Jan Hubicka
2015-10-02 18:00         ` Jan Hubicka
2015-10-02 21:16           ` Eric Botcazou
2015-10-02 21:41             ` Jan Hubicka
2015-10-02 21:52               ` Jan Hubicka
2015-10-05 12:54                 ` Bernd Schmidt
2015-10-05 15:35                   ` Jan Hubicka
2015-10-06 11:18                     ` Richard Biener [this message]
2015-10-06 17:54                       ` Jan Hubicka
2015-10-07  6:00                         ` Jan Hubicka
2015-10-07  8:52                           ` Richard Biener
2015-10-08  3:49                             ` Jan Hubicka
2015-10-08  7:48                               ` Richard Biener
2015-10-08 16:20                                 ` Jan Hubicka
2015-10-08 10:51                               ` Richard Biener
2015-10-08 20:30                                 ` Jan Hubicka
2015-10-08 23:24                                   ` Jan Hubicka
2015-10-09  8:19                                     ` Richard Biener
2015-10-09  8:29                                       ` Eric Botcazou
2015-10-09  7:36                                   ` Eric Botcazou
2015-10-09 17:55                                     ` Jan Hubicka
2015-10-13  8:09                                       ` Alexandre Oliva
2015-10-13  8:39                                         ` Richard Biener
2015-10-13  9:20                                         ` Eric Botcazou
2015-10-13 16:36                                           ` Alexandre Oliva
2015-10-14  4:34                                             ` Jan Hubicka
2015-10-14 20:15                                               ` Alexandre Oliva
2015-10-08 10:54                               ` Eric Botcazou
2015-10-08 16:03                                 ` Jan Hubicka
2015-10-08 16:10                                 ` Andreas Schwab
2015-10-08 23:05                                   ` Jan Hubicka
2015-10-09  9:18                                     ` Andreas Schwab
2015-10-09 18:34                                       ` Jan Hubicka
2015-10-16  6:45                                       ` Jan Hubicka
2015-10-16 15:08                                         ` Andreas Schwab
2015-10-01 14:11 ` Eric Botcazou
2015-10-01 14:28   ` Richard Biener
2015-10-01 14:39     ` Eric Botcazou
2015-10-01 17:44       ` Jan Hubicka
2015-10-02  7:43         ` Eric Botcazou
2015-10-02  8:00           ` Richard Biener
2015-10-02  8:37             ` Eric Botcazou
2015-10-02  7:39       ` Richard Biener
2015-10-02  7:48         ` Eric Botcazou
2015-10-02  8:03           ` Richard Biener
2015-10-02 11:30 Bernd Edlinger
2015-10-02 21:31 ` Eric Botcazou
2015-10-03 16:23   ` Bernd Edlinger
2015-10-03 21:31     ` 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=alpine.LSU.2.11.1510061304480.6516@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=bschmidt@redhat.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=law@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).