* ssa-pre-21.c / PRE for truncated indices
@ 2013-08-15 11:56 Joern Rennecke
2013-08-15 18:06 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Joern Rennecke @ 2013-08-15 11:56 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc
[-- 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" } } */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ssa-pre-21.c / PRE for truncated indices
2013-08-15 11:56 ssa-pre-21.c / PRE for truncated indices Joern Rennecke
@ 2013-08-15 18:06 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2013-08-15 18:06 UTC (permalink / raw)
To: Joern Rennecke; +Cc: gcc
On 8/15/13 1:35 PM, Joern Rennecke wrote:
> 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?
It's a but in the optimizer, the modified testcase should
optimize well on i686. The issue is very likely that
the frontend demotes array indices to sizetype.
You may want to file a bugreport.
Richard.
> FWIW, equivalent behaviour can be seen natively on
> i686-pc-linux-gnu by replacing "long" with "long long",
> as shown in the attachment.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-15 15:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-15 11:56 ssa-pre-21.c / PRE for truncated indices Joern Rennecke
2013-08-15 18:06 ` Richard Biener
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).