Bug 60896 - [4.10 Regression] ICE: in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1449
Summary: [4.10 Regression] ICE: in vect_get_vec_def_for_operand, at tree-vect-stmts.c:...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 5.0
: P1 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-19 17:10 UTC by Markus Trippelsdorf
Modified: 2014-04-25 08:55 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-04-22 00:00:00


Attachments
The patch to fix PR60896 (1.07 KB, patch)
2014-04-23 23:03 UTC, Cong Hou
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Trippelsdorf 2014-04-19 17:10:22 UTC
markus@x4 skia % cat test.ii
struct A
{
  int m_fn1 ();
  short *m_fn2 ();
};
struct B
{
  void *fC;
};
int a, b;
unsigned char i;
void fn1 (unsigned char *p1, A &p2)
{
  int c = p2.m_fn1 ();
  for (int d = 0; c; d++)
    {
      short *e = p2.m_fn2 ();
      unsigned char *f = &p1[0];
      for (int g = 0; g < a; g++)
        {
          int h = e[0];
          b += h * f[g];
        }
    }
}

void fn2 (A &p1, A &p2, B &p3)
{
  int j = p2.m_fn1 ();
  for (int k = 0; j; k++)
    if (0)
      ;
    else
      fn1 (&i, p1);
  if (p3.fC)
    ;
  else
    ;
}

markus@x4 skia % g++ -c -O3 test.ii
test.ii: In function ‘void fn2(A&, A&, B&)’:
test.ii:27:6: internal compiler error: in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1449
 void fn2 (A &p1, A &p2, B &p3)
      ^
Please submit a full bug report,
Comment 1 Richard Biener 2014-04-22 08:57:35 UTC
Confirmed.
Comment 2 Marek Polacek 2014-04-23 18:12:29 UTC
Started with r209524.
Comment 3 Cong Hou 2014-04-23 23:03:10 UTC
Created attachment 32668 [details]
The patch to fix PR60896

The reason of this issue is that those statements in PATTERN_DEF_SEQ in pre-recognized widen-mult pattern are not forwarded to later recognized dot-product pattern. I have created a patch to fix this.

Another issue is that the def types of statements in PATTERN_DEF_SEQ are assigned with the def type of the pattern statement. This is incorrect for reduction pattern statement, in which case all statements in PATTERN_DEF_SEQ will all be vect_reduction_def, and none of them will be vectorized later. The def type of statement in PATTERN_DEF_SEQ should always be vect_internal_def.

This patch will also be submitted to gcc-patch.
Comment 4 Cong Hou 2014-04-25 00:21:17 UTC
Author: congh
Date: Fri Apr 25 00:20:44 2014
New Revision: 209773

URL: http://gcc.gnu.org/viewcvs?rev=209773&root=gcc&view=rev
Log:
2014-04-24  Cong Hou  <congh@google.com>

    PR tree-optimization/60896
    * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Pick up
    all statements in PATTERN_DEF_SEQ in recognized widen-mult pattern.
    (vect_mark_pattern_stmts): Set the def type of all statements in
    PATTERN_DEF_SEQ as vect_internal_def.

2014-04-24  Cong Hou  <congh@google.com>

    PR tree-optimization/60896
    * g++.dg/vect/pr60896.cc: New test.


Added:
    trunk/gcc/testsuite/g++.dg/vect/pr60896.cc
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-patterns.c
Comment 5 Markus Trippelsdorf 2014-04-25 08:55:37 UTC
Fixed. Thanks.