Bug 82289 - [8 Regression] ICE at -O3 on x86_64-linux-gnu: in vect_get_num_copies, at tree-vectorizer.h:1093
Summary: [8 Regression] ICE at -O3 on x86_64-linux-gnu: in vect_get_num_copies, at tre...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: 8.0
Assignee: rsandifo@gcc.gnu.org
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2017-09-22 01:59 UTC by Zhendong Su
Modified: 2017-09-22 17:06 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-09-22 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zhendong Su 2017-09-22 01:59:22 UTC
$ gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170921 (experimental) [trunk revision 253084] (GCC)
$
$ gcctk -O2 -c small.c
$
$ gcctk -O3 -c small.c
during GIMPLE pass: vect
small.c: In function ‘fn1’:
small.c:3:6: internal compiler error: in vect_get_num_copies, at tree-vectorizer.h:1093
 void fn1 (int *j)
      ^~~
0x14b2236 vect_get_num_copies
        ../../gcc-source-trunk/gcc/tree-vectorizer.h:1092
0x14b2236 vect_get_data_access_cost
        ../../gcc-source-trunk/gcc/tree-vect-data-refs.c:1195
0x14b2236 vect_get_peeling_costs_all_drs
        ../../gcc-source-trunk/gcc/tree-vect-data-refs.c:1339
0x14bf48e vect_enhance_data_refs_alignment(_loop_vec_info*)
        ../../gcc-source-trunk/gcc/tree-vect-data-refs.c:1797
0xefe706 vect_analyze_loop_2
        ../../gcc-source-trunk/gcc/tree-vect-loop.c:2018
0xefe706 vect_analyze_loop(loop*, _loop_vec_info*)
        ../../gcc-source-trunk/gcc/tree-vect-loop.c:2354
0xf170e5 vectorize_loops()
        ../../gcc-source-trunk/gcc/tree-vectorizer.c:685
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$


-------------------------------------


int a, b, c, *d, *f[1];

void fn1 (int *j)
{ 
  int e, g, h = 1;
  for (; e; e++)
    { 
      if (g > 0)
        { 
          d = j;
          return;
        }
      if (!h)
        while (g)
          ;
      while (h < 1)
        if (a)
          { 
            fn1 (&h);
            h = 0;
          }
      f[e] = &c;
    }
  while (1)
    ;
}
Comment 1 Martin Liška 2017-09-22 08:03:24 UTC
Confirmed, started with r252764.
Comment 2 rsandifo@gcc.gnu.org 2017-09-22 11:31:26 UTC
Seems like we're considering DRs for statements that aren't relevant.
Comment 3 rsandifo@gcc.gnu.org 2017-09-22 17:05:23 UTC
Author: rsandifo
Date: Fri Sep 22 17:04:51 2017
New Revision: 253103

URL: https://gcc.gnu.org/viewcvs?rev=253103&root=gcc&view=rev
Log:
PR82289: Computing peeling costs for irrelevant drs

This PR shows that we weren't filtering out irrelevant stmts in
vect_get_peeling_costs_all_drs (unlike related loops in which
we iterate over all datarefs).

2017-09-22  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	PR tree-optimization/82289
	* tree-vect-data-refs.c (vect_get_peeling_costs_all_drs): Check
	STMT_VINFO_RELEVANT_P.

gcc/testsuite/
	PR tree-optimization/82289
	* gcc.dg/vect/pr82289.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr82289.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-data-refs.c
Comment 4 rsandifo@gcc.gnu.org 2017-09-22 17:06:38 UTC
Patch applied.