[PATCH] Fix PR81249
Christophe Lyon
christophe.lyon@linaro.org
Fri Jun 30 14:18:00 GMT 2017
Hi Richard,
On 29 June 2017 at 14:53, Richard Biener <rguenther@suse.de> wrote:
>
> Bootstrap and regtest running on x86_64-unknown-linux-gnu.
>
> Richard.
>
> 2017-06-29 Richard Biener <rguenther@suse.de>
>
> PR tree-optimization/81249
> * tree-vect-loop.c (vect_create_epilog_for_reduction): Convert
> condition reduction result to original scalar type.
>
> * g++.dg/torture/pr81249.C: New testcase.
>
I think this patch (r249831) causes a regression on arm / aarch64:
gcc.dg/vect/pr65947-10.c (internal compiler error)
gcc.dg/vect/pr65947-10.c -flto -ffat-lto-objects (internal compiler error)
The regression appears between r249828 and 249831, which seems the
most likely guilty?
The log says:
/testsuite/gcc.dg/vect/pr65947-10.c: In function 'condition_reduction':
/testsuite/gcc.dg/vect/pr65947-10.c:12:1: error: invalid types in nop conversion
float
unsigned int
_47 = (float) _46;
during GIMPLE pass: vect
dump file: pr65947-10.c.159t.vect
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/vect/pr65947-10.c:12:1:
internal compiler error: verify_gimple failed
0xbb9107 verify_gimple_in_cfg(function*, bool)
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-cfg.c:5308
0xa7735c execute_function_todo
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/passes.c:1989
0xa770f5 execute_todo
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/passes.c:2043
Please submit a full bug report,
Christophe
> Index: gcc/tree-vect-loop.c
> ===================================================================
> --- gcc/tree-vect-loop.c (revision 249780)
> +++ gcc/tree-vect-loop.c (working copy)
> @@ -4833,12 +4858,9 @@ vect_create_epilog_for_reduction (vec<tr
>
> /* Convert the reduced value back to the result type and set as the
> result. */
> - tree data_reduc_cast = build1 (VIEW_CONVERT_EXPR, scalar_type,
> - data_reduc);
> - epilog_stmt = gimple_build_assign (new_scalar_dest, data_reduc_cast);
> - new_temp = make_ssa_name (new_scalar_dest, epilog_stmt);
> - gimple_assign_set_lhs (epilog_stmt, new_temp);
> - gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
> + gimple_seq stmts = NULL;
> + new_temp = gimple_convert (&stmts, scalar_type, data_reduc);
> + gsi_insert_seq_before (&exit_gsi, stmts, GSI_SAME_STMT);
> scalar_results.safe_push (new_temp);
> }
> else if (STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info) == COND_REDUCTION
> @@ -4903,6 +4925,11 @@ vect_create_epilog_for_reduction (vec<tr
> val = new_val;
> }
> }
> + /* Convert the reduced value back to the result type and set as the
> + result. */
> + gimple_seq stmts = NULL;
> + val = gimple_convert (&stmts, scalar_type, val);
> + gsi_insert_seq_before (&exit_gsi, stmts, GSI_SAME_STMT);
> scalar_results.safe_push (val);
> }
>
>
> Index: gcc/testsuite/g++.dg/torture/pr81249.C
> ===================================================================
> --- gcc/testsuite/g++.dg/torture/pr81249.C (nonexistent)
> +++ gcc/testsuite/g++.dg/torture/pr81249.C (working copy)
> @@ -0,0 +1,25 @@
> +/* { dg-do compile } */
> +/* { dg-additional-options "-mavx2 -mprefer-avx128" { target x86_64-*-* i?86-*-* } } */
> +
> +typedef struct rtx_def *rtx;
> +union rtunion {
> + rtx rt_rtx;
> +};
> +struct rtx_def {
> + struct {
> + rtunion fld[0];
> + } u;
> + rtx elem[];
> +} a;
> +int b, c, d;
> +rtx e;
> +int main() {
> + for (;;) {
> + d = 0;
> + for (; d < b; d++)
> + if (a.elem[d])
> + e = a.elem[d]->u.fld[1].rt_rtx;
> + if (e)
> + c = 0;
> + }
> +}
More information about the Gcc-patches
mailing list