public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Bin Cheng <Bin.Cheng@arm.com>
Cc: "gcc-patches\@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,  nd <nd@arm.com>
Subject: Re: [PATCH PR71347][Partial revert r235513]Compute cost for all uses in group
Date: Sat, 18 Jun 2016 08:59:00 -0000	[thread overview]
Message-ID: <m2y462yirw.fsf@linux-m68k.org> (raw)
In-Reply-To: <DB5PR08MB1144BCACC3F137372BAC7A63E7530@DB5PR08MB1144.eurprd08.prod.outlook.com>	(Bin Cheng's message of "Mon, 13 Jun 2016 09:57:24 +0000")

Bin Cheng <Bin.Cheng@arm.com> writes:

> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr71347.c b/gcc/testsuite/gcc.dg/tree-ssa/pr71347.c
> new file mode 100644
> index 0000000..7e5ad49
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr71347.c
> @@ -0,0 +1,17 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fdump-tree-optimized" } */
> +
> +double in;
> +extern void Write (double);
> +void foo (void)
> +{
> +  static double X[9];
> +  int i;
> +        X[1] = in * in; 
> +        for (i = 2; i <= 8; i++)
> +            X[i] = X[i - 1] * X[1]; 
> +        Write (X[5]);
> +}
> +
> +/* Load of X[i - i] can be omitted by reusing X[i] in previous iteration.  */
> +/* { dg-final { scan-tree-dump-not ".* = MEM.*;" "optimized"} } */

The test fails on ia64, this is what I get in .optimized:

;; Function foo (foo, funcdef_no=0, decl_uid=1387, cgraph_uid=0, symbol_order=1)

foo ()
{
  int i;
  static double X[9];
  double in.0_1;
  double in.1_2;
  double _3;
  int _4;
  double _5;
  double _6;
  double _7;
  double _8;

  <bb 2>:
  in.0_1 = in;
  in.1_2 = in;
  _3 = in.0_1 * in.1_2;
  X[1] = _3;
  i_13 = 2;
  goto <bb 4>;

  <bb 3>:
  _4 = i_9 + -1;
  _5 = X[_4];
  _6 = X[1];
  _7 = _5 * _6;
  X[i_9] = _7;
  i_15 = i_9 + 1;

  <bb 4>:
  # i_9 = PHI <i_13(2), i_15(3)>
  if (i_9 <= 8)
    goto <bb 3>;
  else
    goto <bb 5>;

  <bb 5>:
  _8 = X[5];
  Write (_8);
  return;

}


Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

  parent reply	other threads:[~2016-06-18  8:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13  9:57 Bin Cheng
2016-06-13 10:10 ` Richard Biener
2016-06-18  8:59 ` Andreas Schwab [this message]
2016-06-20  8:18   ` Christophe Lyon
2016-06-20  8:20     ` Bin.Cheng
2016-06-20  9:11       ` Bin.Cheng
2016-06-20  9:19         ` Andreas Schwab

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=m2y462yirw.fsf@linux-m68k.org \
    --to=schwab@linux-m68k.org \
    --cc=Bin.Cheng@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nd@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).