mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-21 00:11:00 +08:00
tree-optimization/109473 - ICE with reduction epilog adjustment op
The following makes sure to carry out the reduction epilog adjustment in the original computation type which for pointers is an unsigned integer type. There's a similar issue with signed vs. unsigned ops and overflow which is fixed by this as well. PR tree-optimization/109473 * tree-vect-loop.cc (vect_create_epilog_for_reduction): Convert scalar result to the computation type before performing the reduction adjustment. * gcc.dg/vect/pr109473.c: New testcase.
This commit is contained in:
parent
2273fd5a6f
commit
df7f55cb2a
16
gcc/testsuite/gcc.dg/vect/pr109473.c
Normal file
16
gcc/testsuite/gcc.dg/vect/pr109473.c
Normal file
@ -0,0 +1,16 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-additional-options "-O" } */
|
||||
|
||||
struct spa_buffer {
|
||||
__UINT32_TYPE__ *metas;
|
||||
};
|
||||
void do_port_use_buffers(struct spa_buffer **buffers, void *endptr, void *mem)
|
||||
{
|
||||
for (int i = 0; i < 128; i++)
|
||||
{
|
||||
for (int j = 0; j < 128; j++)
|
||||
endptr = (void *)((__UINTPTR_TYPE__)endptr + buffers[i]->metas[j]);
|
||||
if (endptr > mem)
|
||||
return;
|
||||
}
|
||||
}
|
@ -6297,9 +6297,12 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
|
||||
{
|
||||
new_temp = scalar_results[0];
|
||||
gcc_assert (TREE_CODE (TREE_TYPE (adjustment_def)) != VECTOR_TYPE);
|
||||
adjustment_def = gimple_convert (&stmts, scalar_type, adjustment_def);
|
||||
new_temp = gimple_build (&stmts, code, scalar_type,
|
||||
adjustment_def = gimple_convert (&stmts, TREE_TYPE (vectype),
|
||||
adjustment_def);
|
||||
new_temp = gimple_convert (&stmts, TREE_TYPE (vectype), new_temp);
|
||||
new_temp = gimple_build (&stmts, code, TREE_TYPE (vectype),
|
||||
new_temp, adjustment_def);
|
||||
new_temp = gimple_convert (&stmts, scalar_type, new_temp);
|
||||
}
|
||||
|
||||
epilog_stmt = gimple_seq_last_stmt (stmts);
|
||||
|
Loading…
x
Reference in New Issue
Block a user