diff mbox

: [Bug tree-optimization/61917] [4.9/5 Regression] ICE on valid code at -O3 on x86_64-linux-gnu in vectorizable_reduction, at tree-vect-loop.c:4913

Message ID CAEwic4b_Yg9AO-LcDQd_OeVCL0zEf1M1dCZstuYhKkkA3djuhg@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Feb. 25, 2015, 1:10 p.m. UTC
Hello,

So, I did full regression-test for following patch:

ChangeLog

2015-02-25  Richard Biener  <rguenther@suse.de>
    Kai Tietz  <ktietz@redhat.com>

    PR tree-optimization/61917
    * tree-vect-loop.c (vectorizable_reduction): Allow
    vect_internal_def without reduction to exit graceful.

ChagneLog testsuite/

2015-02-25  Kai Tietz  <ktietz@redhat.com>

    PR tree-optimization/61917
    * gcc.dg/vect/vect-pr61917.c: New file.

Tested for x86_64-unkown-linux.  Ok for apply?

Regards,
Kai

Comments

Richard Biener Feb. 25, 2015, 1:22 p.m. UTC | #1
On Wed, Feb 25, 2015 at 2:10 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
> Hello,
>
> So, I did full regression-test for following patch:
>
> ChangeLog
>
> 2015-02-25  Richard Biener  <rguenther@suse.de>
>     Kai Tietz  <ktietz@redhat.com>
>
>     PR tree-optimization/61917
>     * tree-vect-loop.c (vectorizable_reduction): Allow
>     vect_internal_def without reduction to exit graceful.
>
> ChagneLog testsuite/
>
> 2015-02-25  Kai Tietz  <ktietz@redhat.com>
>
>     PR tree-optimization/61917
>     * gcc.dg/vect/vect-pr61917.c: New file.
>
> Tested for x86_64-unkown-linux.  Ok for apply?

Ok.

Thanks,
Richard.

> Regards,
> Kai
>
> Index: tree-vect-loop.c
> ===================================================================
> --- tree-vect-loop.c    (Revision 220958)
> +++ tree-vect-loop.c    (Arbeitskopie)
> @@ -4981,6 +4981,12 @@ vectorizable_reduction (gimple stmt, gimple_stmt_i
>    if (!vectype_in)
>      vectype_in = tem;
>    gcc_assert (is_simple_use);
> +  if (!found_nested_cycle_def)
> +    reduc_def_stmt = def_stmt;
> +
> +  if (gimple_code (reduc_def_stmt) != GIMPLE_PHI)
> +    return false;
> +
>    if (!(dt == vect_reduction_def
>      || dt == vect_nested_cycle
>      || ((dt == vect_internal_def || dt == vect_external_def
> @@ -4993,10 +4999,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_i
>        gcc_assert (orig_stmt);
>        return false;
>      }
> -  if (!found_nested_cycle_def)
> -    reduc_def_stmt = def_stmt;
>
> -  gcc_assert (gimple_code (reduc_def_stmt) == GIMPLE_PHI);
>    if (orig_stmt)
>      gcc_assert (orig_stmt == vect_is_simple_reduction (loop_vinfo,
>                                                         reduc_def_stmt,
> Index: gcc/gcc/testsuite/gcc.dg/vect/vect-pr61917.c
> ===================================================================
> --- /dev/null
> +++ gcc/gcc/testsuite/gcc.dg/vect/vect-pr61917.c
> @@ -0,0 +1,13 @@
> +/* { dg-do compile } */
> +/* { dg-additional-options "-O3" } */
> +
> +int a, b, c, d;
> +
> +int
> +fn1 ()
> +{
> +  for (; c; c++)
> +    for (b = 0; b < 2; b++)
> +      d = a - d;
> +  return d;
> +}
H.J. Lu Feb. 25, 2015, 4:51 p.m. UTC | #2
On Wed, Feb 25, 2015 at 5:10 AM, Kai Tietz <ktietz70@googlemail.com> wrote:
> Hello,
>
> So, I did full regression-test for following patch:
>
> ChangeLog
>
> 2015-02-25  Richard Biener  <rguenther@suse.de>
>     Kai Tietz  <ktietz@redhat.com>
>
>     PR tree-optimization/61917
>     * tree-vect-loop.c (vectorizable_reduction): Allow
>     vect_internal_def without reduction to exit graceful.
>

I think it caused:

FAIL: gcc.dg/pr56350.c (internal compiler error)
FAIL: gcc.dg/pr56350.c (test for excess errors)

[hjl@gnu-6 gcc]$ ./xgcc -B./ -O -ftree-vectorize
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/pr56350.c
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/pr56350.c: In
function ‘f’:
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/pr56350.c:8:1:
internal compiler error: Segmentation fault
 f (void)
 ^
0xd1f836 crash_signal
/export/gnu/import/git/sources/gcc/gcc/toplev.c:383
0xfaf59a gimple_code
/export/gnu/import/git/sources/gcc/gcc/gimple.h:1553
0xfbd855 vectorizable_reduction(gimple_statement_base*,
gimple_stmt_iterator*, gimple_statement_base**, _slp_tree*)
/export/gnu/import/git/sources/gcc/gcc/tree-vect-loop.c:4987
0xfabc86 vect_analyze_stmt(gimple_statement_base*, bool*, _slp_tree*)
/export/gnu/import/git/sources/gcc/gcc/tree-vect-stmts.c:7170
0xfb50c9 vect_analyze_loop_operations
/export/gnu/import/git/sources/gcc/gcc/tree-vect-loop.c:1539
0xfb58cc vect_analyze_loop_2
/export/gnu/import/git/sources/gcc/gcc/tree-vect-loop.c:1800
0xfb5c70 vect_analyze_loop(loop*)
/export/gnu/import/git/sources/gcc/gcc/tree-vect-loop.c:1898
0xfd558f vectorize_loops()
/export/gnu/import/git/sources/gcc/gcc/tree-vectorizer.c:451
0xed3699 execute
/export/gnu/import/git/sources/gcc/gcc/tree-ssa-loop.c:295
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-6 gcc]$
Alex Velenko Feb. 26, 2015, 12:03 p.m. UTC | #3
On 25/02/15 16:51, H.J. Lu wrote:
> On Wed, Feb 25, 2015 at 5:10 AM, Kai Tietz <ktietz70@googlemail.com> wrote:
>> Hello,
>>
>> So, I did full regression-test for following patch:
>>
>> ChangeLog
>>
>> 2015-02-25  Richard Biener  <rguenther@suse.de>
>>      Kai Tietz  <ktietz@redhat.com>
>>
>>      PR tree-optimization/61917
>>      * tree-vect-loop.c (vectorizable_reduction): Allow
>>      vect_internal_def without reduction to exit graceful.
>>
>
> I think it caused:
>
> FAIL: gcc.dg/pr56350.c (internal compiler error)
> FAIL: gcc.dg/pr56350.c (test for excess errors)
>
> [hjl@gnu-6 gcc]$ ./xgcc -B./ -O -ftree-vectorize
> /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/pr56350.c
> /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/pr56350.c: In
> function ‘f’:
> /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/pr56350.c:8:1:
> internal compiler error: Segmentation fault
>   f (void)
>   ^
> 0xd1f836 crash_signal
> /export/gnu/import/git/sources/gcc/gcc/toplev.c:383
> 0xfaf59a gimple_code
> /export/gnu/import/git/sources/gcc/gcc/gimple.h:1553
> 0xfbd855 vectorizable_reduction(gimple_statement_base*,
> gimple_stmt_iterator*, gimple_statement_base**, _slp_tree*)
> /export/gnu/import/git/sources/gcc/gcc/tree-vect-loop.c:4987
> 0xfabc86 vect_analyze_stmt(gimple_statement_base*, bool*, _slp_tree*)
> /export/gnu/import/git/sources/gcc/gcc/tree-vect-stmts.c:7170
> 0xfb50c9 vect_analyze_loop_operations
> /export/gnu/import/git/sources/gcc/gcc/tree-vect-loop.c:1539
> 0xfb58cc vect_analyze_loop_2
> /export/gnu/import/git/sources/gcc/gcc/tree-vect-loop.c:1800
> 0xfb5c70 vect_analyze_loop(loop*)
> /export/gnu/import/git/sources/gcc/gcc/tree-vect-loop.c:1898
> 0xfd558f vectorize_loops()
> /export/gnu/import/git/sources/gcc/gcc/tree-vectorizer.c:451
> 0xed3699 execute
> /export/gnu/import/git/sources/gcc/gcc/tree-ssa-loop.c:295
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <http://gcc.gnu.org/bugs.html> for instructions.
> [hjl@gnu-6 gcc]$
>
>
Hi,
This patch also breaks gcc.dg/pr56350.c for aarch64-none-elf, 
arm-none-eabi and other arm targets. Failure looks very similar:

src/gcc/gcc/testsuite/gcc.dg/pr56350.c: In function 'f':

src/gcc/gcc/testsuite/gcc.dg/pr56350.c:8:1: internal compiler error: 
Segmentation fault

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.

compiler exited with status 1
output is:
src/gcc/gcc/testsuite/gcc.dg/pr56350.c: In function 'f':

src/gcc/gcc/testsuite/gcc.dg/pr56350.c:8:1: internal compiler error: 
Segmentation fault

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.

Kind regards,
Alex
Jakub Jelinek Feb. 26, 2015, 12:12 p.m. UTC | #4
On Thu, Feb 26, 2015 at 12:03:46PM +0000, Alex Velenko wrote:
> This patch also breaks gcc.dg/pr56350.c for aarch64-none-elf, arm-none-eabi
> and other arm targets. Failure looks very similar:

Just svn update?  r220987 should fix this.

	Jakub
Alex Velenko Feb. 26, 2015, 1:45 p.m. UTC | #5
Hi Jakub,
Just tested with latest svn update. The issue is indeed gone.
Kind regards,
Alex

On 26/02/15 12:12, Jakub Jelinek wrote:
> On Thu, Feb 26, 2015 at 12:03:46PM +0000, Alex Velenko wrote:
>> This patch also breaks gcc.dg/pr56350.c for aarch64-none-elf, arm-none-eabi
>> and other arm targets. Failure looks very similar:
>
> Just svn update?  r220987 should fix this.
>
> 	Jakub
>
diff mbox

Patch

Index: tree-vect-loop.c
===================================================================
--- tree-vect-loop.c    (Revision 220958)
+++ tree-vect-loop.c    (Arbeitskopie)
@@ -4981,6 +4981,12 @@  vectorizable_reduction (gimple stmt, gimple_stmt_i
   if (!vectype_in)
     vectype_in = tem;
   gcc_assert (is_simple_use);
+  if (!found_nested_cycle_def)
+    reduc_def_stmt = def_stmt;
+
+  if (gimple_code (reduc_def_stmt) != GIMPLE_PHI)
+    return false;
+
   if (!(dt == vect_reduction_def
     || dt == vect_nested_cycle
     || ((dt == vect_internal_def || dt == vect_external_def
@@ -4993,10 +4999,7 @@  vectorizable_reduction (gimple stmt, gimple_stmt_i
       gcc_assert (orig_stmt);
       return false;
     }
-  if (!found_nested_cycle_def)
-    reduc_def_stmt = def_stmt;

-  gcc_assert (gimple_code (reduc_def_stmt) == GIMPLE_PHI);
   if (orig_stmt)
     gcc_assert (orig_stmt == vect_is_simple_reduction (loop_vinfo,
                                                        reduc_def_stmt,
Index: gcc/gcc/testsuite/gcc.dg/vect/vect-pr61917.c
===================================================================
--- /dev/null
+++ gcc/gcc/testsuite/gcc.dg/vect/vect-pr61917.c
@@ -0,0 +1,13 @@ 
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+int a, b, c, d;
+
+int
+fn1 ()
+{
+  for (; c; c++)
+    for (b = 0; b < 2; b++)
+      d = a - d;
+  return d;
+}