public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joern Rennecke <joern.rennecke@embecosm.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc@gcc.gnu.org
Subject: ssa-pre-21.c / PRE for truncated indices
Date: Thu, 15 Aug 2013 11:56:00 -0000	[thread overview]
Message-ID: <20130815073557.i2u9oatlskw84k8s-nzlynne@webmail.spamcop.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

I see that gcc.dg/tree-ssa/ssa-pre-21.c fails for avr.
The computation of k + 1L is done as unsigned int (16 bit),
but later ++k is performed as unsigned long (32 bit), and thus
array[k+1] is not re-used.

Is this to be considered a big in the optimizers for not
optimizing this, or in the testsuite for insisting that it
should be?

FWIW, equivalent behaviour can be seen natively on
i686-pc-linux-gnu by replacing "long" with "long long",
as shown in the attachment.

[-- Attachment #2: ssa-pre-21-ll.c --]
[-- Type: text/x-chdr, Size: 356 bytes --]

/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-pre" } */

long long
NumSift (long long *array, unsigned long long k)
{
  if (array[k] < array[k + 1LL])
    ++k;
  return array[k];
}

/* There should be only two loads left.  */

/* { dg-final { scan-tree-dump-times "= \\\*\[^\n;\]*;" 2 "pre" } } */
/* { dg-final { cleanup-tree-dump "pre" } } */

             reply	other threads:[~2013-08-15 11:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 11:56 Joern Rennecke [this message]
2013-08-15 18:06 ` Richard Biener

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=20130815073557.i2u9oatlskw84k8s-nzlynne@webmail.spamcop.net \
    --to=joern.rennecke@embecosm.com \
    --cc=gcc@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).