* [PATCH 1/5][v3] Avoid ICE with pointer reduction
@ 2024-05-31 13:43 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2024-05-31 13:43 UTC (permalink / raw)
To: gcc-patches
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.
---
gcc/tree-vect-loop.cc | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 04a9ac64df7..fc690336b38 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -5608,6 +5608,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;
@@ -5616,14 +5622,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),
--
2.35.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-31 13:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-31 13:43 [PATCH 1/5][v3] Avoid ICE with pointer reduction Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).