From f234d26028c5a031dd4cd5f33133de7b8ae5293c Mon Sep 17 00:00:00 2001 From: Bingfeng Mei Date: Mon, 23 Dec 2013 15:07:58 +0000 Subject: [PATCH] re PR middle-end/59569 (r206148 causes internal compiler error: in vect_create_destination_var, at tree-vect-data-refs.c:4294) 2013-12-23 Bingfeng Mei PR middle-end/59569 * tree-vect-stmts.c (vectorizable_store): Skip permutation for consant operand, and add a few missing \n. * gcc.c-torture/compile/pr59569-1.c: New test. * gcc.c-torture/compile/pr59569-2.c: Ditto. From-SVN: r206179 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.c-torture/compile/pr59569-1.c | 9 +++++++++ gcc/testsuite/gcc.c-torture/compile/pr59569-2.c | 6 ++++++ gcc/tree-vect-stmts.c | 14 +++++++++----- 5 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr59569-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr59569-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9a5b7984d31..b9fe7632681 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-12-23 Bingfeng Mei + + PR middle-end/59569 + * tree-vect-stmts.c (vectorizable_store): Skip permutation for + consant/external operand, and add a few missing \n. + 2013-12-23 H.J. Lu Tocar Ilya diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fbd5ba13160..c4fad36aa9e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-12-23 Bingfeng Mei + + PR middle-end/59569 + * gcc.c-torture/compile/pr59569-1.c: New test. + * gcc.c-torture/compile/pr59569-2.c: Ditto. + 2013-12-23 Marek Polacek PR c++/59111 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr59569-1.c b/gcc/testsuite/gcc.c-torture/compile/pr59569-1.c new file mode 100644 index 00000000000..116c72474cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr59569-1.c @@ -0,0 +1,9 @@ +/* PR middle-end/59569 */ +extern char c; + +void +foo (int i, char **j) +{ + while (i) + j[--i] = &c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr59569-2.c b/gcc/testsuite/gcc.c-torture/compile/pr59569-2.c new file mode 100644 index 00000000000..e813b88d857 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr59569-2.c @@ -0,0 +1,6 @@ +/* PR middle-end/59569 */ +void foo (int *a, int b) +{ + for (; b; b--) + a[b] = 1; +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 18cf5630ca2..e3009d9a474 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -5005,7 +5005,7 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "multiple types with negative step."); + "multiple types with negative step.\n"); return false; } @@ -5018,14 +5018,16 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "negative step but alignment required."); + "negative step but alignment required.\n"); return false; } - if (!perm_mask_for_reverse (vectype)) + if (dt != vect_constant_def + && dt != vect_external_def + && !perm_mask_for_reverse (vectype)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "negative step and reversing not supported."); + "negative step and reversing not supported.\n"); return false; } } @@ -5353,7 +5355,9 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, set_ptr_info_alignment (get_ptr_info (dataref_ptr), align, misalign); - if (negative) + if (negative + && dt != vect_constant_def + && dt != vect_external_def) { tree perm_mask = perm_mask_for_reverse (vectype); tree perm_dest