https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69053

--- Comment #4 from alahay01 at gcc dot gnu.org ---
(In reply to alalaw01 from comment #3)
> Well, this fixes it, but I'm not sure it fixes it in the right place...
> 
> diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
> index ee32166..bd66aa5 100644
> --- a/gcc/tree-vect-loop.c
> +++ b/gcc/tree-vect-loop.c
> @@ -4178,7 +4178,9 @@ get_initial_def_for_reduction (gimple *stmt, tree
> init_val
>                 break;
>               }
>           }
> -       init_def = build_vector_from_val (vectype, init_value);
> +       init_def = build_vector_from_val (vectype,
> +                                         fold_convert (TREE_TYPE (vectype),
> +                                                       init_value));
>         break;
>  
>        default:

I don’t think we can move the conversion any earlier, it needs to be somewhere
in get_initial_def_for_reduction.
Possibly you could move the fold_convert on init_val earlier in the function
just before the switch statement, but that has the potential to break more
things. So I’d probably leave it where it is.

Also, the fold_convert should just vanish if there is nothing to do, so that
shouldn't be an issue for existing vectorisations.

Reply via email to