public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: Jiangning Liu <jiangning.liu@arm.com>
Cc: gcc@gcc.gnu.org
Subject: Re: Why can't copy renaming capture this assignment?
Date: Mon, 02 Apr 2012 08:37:00 -0000	[thread overview]
Message-ID: <CAFiYyc3N6bWM=_Src6XJ8cRLdQX=_QM4CP8FtuiLjWCdvdLSGQ@mail.gmail.com> (raw)
In-Reply-To: <4f7686a1.6548b60a.5636.2b32SMTPIN_ADDED@mx.google.com>

On Sat, Mar 31, 2012 at 6:23 AM, Jiangning Liu <jiangning.liu@arm.com> wrote:
> Hi,
>
> For this small case,
>
> char garr[100];
> void f(void)
> {
>        unsigned short h, s;
>
>        s = 20;
>
>        for (h = 1; h < (s-1); h++)
>        {
>                garr[h] = 0;
>        }
> }
>
> After copyrename3, we have the following dump,
>
> f ()
> {
>  short unsigned int h;
>  int D.4066;
>
> <bb 2>:
>  D.4066_14 = 1;
>  if (D.4066_14 <= 18)
>    goto <bb 3>;
>  else
>    goto <bb 4>;
>
> <bb 3>:
>  # h_15 = PHI <h_8(3), 1(2)>
>  # D.4066_16 = PHI <D.4066_4(3), D.4066_14(2)>
>  garr[D.4066_16] = 0;
>  h_8 = h_15 + 1;
>  D.4066_4 = (int) h_8;
>  if (D.4066_4 <= 18)
>    goto <bb 3>;
>  else
>    goto <bb 4>;
>
> <bb 4>:
>  return;
>
> }
>
> copy renaming fails to capture the assignment statement "D.4066_4 = (int)
> h_8;" to trigger renaming partition coalesce.
>
> I find gimple_assign_single_p invoked by gimple_assign_ssa_name_copy_p
> always returns false, because for this statement " gs->gsbase.subcode" is
> NOP_EXPR rather than GIMPLE_SINGLE_RHS.
>
> Should subcode be correctly initialized anywhere to fix this problem?
>
> BTW, my expectation after copy renaming is like below,
>
> f ()
> {
>  int D.4679;
>
> <bb 2>:
>  D.4679_7 = 1;
>  if (D.4679_7 != 19)
>    goto <bb 3>;
>  else
>    goto <bb 4>;
>
> <bb 3>:
>  # D.4679_15 = PHI <D.4679_4(3), D.4679_7(2)>
>  # D.4679_17 = PHI <D.4679_14(3), 1(2)>
>  garr[D.4679_15] = 0;
>  D.4679_14 = D.4679_17 + 1;
>  D.4679_4 = D.4679_14;
>  if (D.4679_4 != 19)
>    goto <bb 3>;
>  else
>    goto <bb 4>;
>
> <bb 4>:
>  return;
>
> }

Err - you completely lost the fact that h was short instead of int.

Richard.

> and then PRE can finally remove that redundancy for symbol D.xxxx away.
>
> Thanks,
> -Jiangning
>
>
>
>
>

       reply	other threads:[~2012-04-02  8:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4f7686a1.6548b60a.5636.2b32SMTPIN_ADDED@mx.google.com>
2012-04-02  8:37 ` Richard Guenther [this message]
     [not found]   ` <CAOQ849PLycvKE4p7xkB-Teu-MN-5pjpWFMqOCb4xrUt-q8CTRA@mail.gmail.com>
2012-04-03  8:51     ` Richard Guenther
     [not found]       ` <CAOQ849Pio87BYadK9MV49GwuXtrQsdWKynCFJQoSHcaEozS0ig@mail.gmail.com>
2012-04-04  8:49         ` Richard Guenther
2012-03-31  4:22 Jiangning Liu

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='CAFiYyc3N6bWM=_Src6XJ8cRLdQX=_QM4CP8FtuiLjWCdvdLSGQ@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jiangning.liu@arm.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).