aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-05-31 15:17:10 +0200
committerRichard Biener <rguenther@suse.de>2024-06-03 09:24:24 +0200
commita1810364cd0c36d6408a4c386bdc504a021d68c7 (patch)
treef80c2aba76ec37fd5f1c55e0eaf3979eda67f1c2 /gcc
parentac306de7d5100d3682eae2270995a9abbe19db38 (diff)
downloadgcc-a1810364cd0c36d6408a4c386bdc504a021d68c7.zip
gcc-a1810364cd0c36d6408a4c386bdc504a021d68c7.tar.gz
gcc-a1810364cd0c36d6408a4c386bdc504a021d68c7.tar.bz2
Avoid ICE with pointer reduction
There's another case where we can refer to neutral_op before eventually converting it from pointer to integer so simply do that unconditionally. * tree-vect-loop.cc (get_initial_defs_for_reduction): Always convert neutral_op.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/tree-vect-loop.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 5b85cff..b6e0b96 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -5606,6 +5606,12 @@ get_initial_defs_for_reduction (loop_vec_info loop_vinfo,
tree_vector_builder elts (vector_type, nunits, 1);
elts.quick_grow (nunits);
gimple_seq ctor_seq = NULL;
+ if (neutral_op
+ && !useless_type_conversion_p (TREE_TYPE (vector_type),
+ TREE_TYPE (neutral_op)))
+ neutral_op = gimple_convert (&ctor_seq,
+ TREE_TYPE (vector_type),
+ neutral_op);
for (j = 0; j < nunits * number_of_vectors; ++j)
{
tree op;
@@ -5614,14 +5620,7 @@ get_initial_defs_for_reduction (loop_vec_info loop_vinfo,
/* Get the def before the loop. In reduction chain we have only
one initial value. Else we have as many as PHIs in the group. */
if (i >= initial_values.length () || (j > i && neutral_op))
- {
- if (!useless_type_conversion_p (TREE_TYPE (vector_type),
- TREE_TYPE (neutral_op)))
- neutral_op = gimple_convert (&ctor_seq,
- TREE_TYPE (vector_type),
- neutral_op);
- op = neutral_op;
- }
+ op = neutral_op;
else
{
if (!useless_type_conversion_p (TREE_TYPE (vector_type),