mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 22:41:28 +08:00
re PR tree-optimization/36038 (miscompiled loop in perlbmk for -Os)
PR tree-optimization/36038 * tree-ssa-loop-ivopts.c (add_old_iv_candidates): For pointer bases add sizetype IV with initial value zero instead of pointer type. * gcc.c-torture/compile/pr36038.c: New test. From-SVN: r141343
This commit is contained in:
parent
918bf5c10e
commit
1a00e5f7fb
@ -1,3 +1,9 @@
|
||||
2008-10-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/36038
|
||||
* tree-ssa-loop-ivopts.c (add_old_iv_candidates): For pointer bases
|
||||
add sizetype IV with initial value zero instead of pointer type.
|
||||
|
||||
2008-10-24 Manuel López-Ibáñez <manu@gcc.gnu.org>
|
||||
|
||||
PR c/7543
|
||||
|
@ -1,3 +1,8 @@
|
||||
2008-10-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/36038
|
||||
* gcc.c-torture/compile/pr36038.c: New test.
|
||||
|
||||
2008-10-24 Manuel López-Ibáñez <manu@gcc.gnu.org>
|
||||
|
||||
PR c/7543
|
||||
|
43
gcc/testsuite/gcc.c-torture/compile/pr36038.c
Normal file
43
gcc/testsuite/gcc.c-torture/compile/pr36038.c
Normal file
@ -0,0 +1,43 @@
|
||||
/* PR tree-optimization/36038 */
|
||||
|
||||
long long list[10];
|
||||
long long expect[10] = { 0, 1, 2, 3, 4, 4, 5, 6, 7, 9 };
|
||||
long long *stack_base;
|
||||
int indices[10];
|
||||
int *markstack_ptr;
|
||||
|
||||
void
|
||||
doit (void)
|
||||
{
|
||||
long long *src;
|
||||
long long *dst;
|
||||
long long *sp = stack_base + 5;
|
||||
int diff = 2;
|
||||
int shift;
|
||||
int count;
|
||||
|
||||
shift = diff - (markstack_ptr[-1] - markstack_ptr[-2]);
|
||||
count = (sp - stack_base) - markstack_ptr[-1] + 2;
|
||||
src = sp;
|
||||
dst = (sp += shift);
|
||||
while (--count)
|
||||
*dst-- = *src--;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
list[i] = i;
|
||||
|
||||
markstack_ptr = indices + 9;
|
||||
markstack_ptr[-1] = 2;
|
||||
markstack_ptr[-2] = 1;
|
||||
|
||||
stack_base = list + 2;
|
||||
doit ();
|
||||
if (__builtin_memcmp (expect, list, sizeof (list)))
|
||||
__builtin_abort ();
|
||||
return 0;
|
||||
}
|
@ -2228,9 +2228,11 @@ add_old_iv_candidates (struct ivopts_data *data, struct iv *iv)
|
||||
add_candidate (data, iv->base, iv->step, true, NULL);
|
||||
|
||||
/* The same, but with initial value zero. */
|
||||
add_candidate (data,
|
||||
build_int_cst (TREE_TYPE (iv->base), 0),
|
||||
iv->step, true, NULL);
|
||||
if (POINTER_TYPE_P (TREE_TYPE (iv->base)))
|
||||
add_candidate (data, size_int (0), iv->step, true, NULL);
|
||||
else
|
||||
add_candidate (data, build_int_cst (TREE_TYPE (iv->base), 0),
|
||||
iv->step, true, NULL);
|
||||
|
||||
phi = SSA_NAME_DEF_STMT (iv->ssa_name);
|
||||
if (gimple_code (phi) == GIMPLE_PHI)
|
||||
|
Loading…
x
Reference in New Issue
Block a user