This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
ssa-pre-21.c / PRE for truncated indices
- From: Joern Rennecke <joern dot rennecke at embecosm dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 15 Aug 2013 07:35:57 -0400
- Subject: ssa-pre-21.c / PRE for truncated indices
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.
/* { 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" } } */