diff options
author | Richard Biener <rguenther@suse.de> | 2023-04-12 10:22:08 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-04-12 11:31:28 +0200 |
commit | df7f55cb2ae550adeda339a57b657ebe1ad39367 (patch) | |
tree | a39baaef47641c9471cbb52814cb84ed93e8d139 /gcc/tree-vect-loop.cc | |
parent | 2273fd5a6fdbe8f7da2c0e217c279bcbaaa7df9e (diff) | |
download | gcc-df7f55cb2ae550adeda339a57b657ebe1ad39367.zip gcc-df7f55cb2ae550adeda339a57b657ebe1ad39367.tar.gz gcc-df7f55cb2ae550adeda339a57b657ebe1ad39367.tar.bz2 |
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.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r-- | gcc/tree-vect-loop.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 1ba9f18..ba28214 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -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); |