Bug 92516 - [10 Regression] ICE in vect_schedule_slp_instance, at tree-vect-slp.c:4095 since r278246
Summary: [10 Regression] ICE in vect_schedule_slp_instance, at tree-vect-slp.c:4095 si...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: 10.0
Assignee: Richard Sandiford
URL:
Keywords: ice-on-valid-code, needs-reduction
Depends on:
Blocks:
 
Reported: 2019-11-14 20:12 UTC by David Binderman
Modified: 2019-11-18 14:12 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 9.2.0
Known to fail: 10.0
Last reconfirmed: 2019-11-15 00:00:00


Attachments
gzipped C++ source code (881.41 KB, application/gzip)
2019-11-14 20:12 UTC, David Binderman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2019-11-14 20:12:07 UTC
Created attachment 47267 [details]
gzipped C++ source code

The attached C++ code, when compiled by recent gcc trunk
and compiler flags -O3 -std=c++1z, does this:

internal compiler error: in vect_schedule_slp_instance, at tree-vect-slp.c:4095
 1447 | void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
      |      ^~~~~~~~~
0x80978a vect_schedule_slp_instance
	../../trunk/gcc/tree-vect-slp.c:4095
0x13c0013 vect_schedule_slp_instance
	../../trunk/gcc/tree-vect-slp.c:4077
0x13c0013 vect_schedule_slp_instance
	../../trunk/gcc/tree-vect-slp.c:4077
0x13c0013 vect_schedule_slp_instance
	../../trunk/gcc/tree-vect-slp.c:4077
Comment 1 David Binderman 2019-11-14 20:20:04 UTC
Problem first seems to occur sometime between revision 278200
and 278250.

Code reduction now in progress, but since the size of the partially
reduced code is currently 5.4 Megs, this is expected to take quite some time.
Comment 2 Marek Polacek 2019-11-14 20:22:32 UTC
vect_* -> not a C++ FE issue.
Comment 3 David Binderman 2019-11-15 07:42:06 UTC
Agreed. 

Since code is fine with -O2, but not with -O3, then
it looks like an optimiser problem to me.

About 2 hours of reduction has already been done. More is in progress.
Current size is about 2.2 Megs.
Comment 4 Richard Biener 2019-11-15 08:13:36 UTC
Hmm, the ICE on the unreduced testcase doesn't reproduce for me, but I can't remember a fix in this area.  Which rev. were you testing?
Comment 5 David Binderman 2019-11-15 08:19:15 UTC
Please see my comment above. Ok at 278200, broken at 278250.

Or have I misunderstood something ?
Comment 6 rguenther@suse.de 2019-11-15 08:49:16 UTC
On Fri, 15 Nov 2019, dcb314 at hotmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92516
> 
> --- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
> Please see my comment above. Ok at 278200, broken at 278250.
> 
> Or have I misunderstood something ?

Ah sorry - missed that.
Comment 7 Martin Liška 2019-11-15 09:04:14 UTC
I can confirm that, started with r278246.
Comment 8 David Binderman 2019-11-15 09:56:21 UTC
Reduced C++ code:

class a {
public:
  typedef int b;
  operator b();
};
class c {
public:
  constexpr int m_fn1() const;
  constexpr int d() const;
  int e;
  int f;
};
constexpr int c::m_fn1() const { return e; }
constexpr int c::d() const { return f; }
class g {
public:
  g();
  constexpr void i(const c &) noexcept;
  int j;
  int k;
  int l;
  int m;
};
constexpr void g::i(const c &n) noexcept {
  int v = l - j, h = m - k;
  j = n.m_fn1() - v / 2;
  k = n.d() - h / 2;
  l = j + v;
  m = k + h;
}
class o {
  void m_fn4() const;
  a p;
} r;
void o::m_fn4() const {
  g q;
  c t;
  q.i(t);
  r.p || 0;
}
Comment 9 Richard Biener 2019-11-18 14:07:42 UTC
Author: rguenth
Date: Mon Nov 18 14:07:11 2019
New Revision: 278406

URL: https://gcc.gnu.org/viewcvs?rev=278406&root=gcc&view=rev
Log:
2019-11-18  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/92516
	* tree-vect-slp.c (vect_analyze_slp_instance): Add bst_map
	argument, hoist bst_map creation/destruction to ...
	(vect_analyze_slp): ... here, forming a true graph with
	SLP instances being the entries.
	(vect_detect_hybrid_slp_stmts): Remove wrapper.
	(vect_detect_hybrid_slp): Use one visited set for all
	graph entries.
	(vect_slp_analyze_node_operations): Simplify visited/lvisited
	to hash-sets of slp_tree.
	(vect_slp_analyze_operations): Likewise.
	(vect_bb_slp_scalar_cost): Remove wrapper.
	(vect_bb_vectorization_profitable_p): Use one visited set for
	all graph entries.
	(vect_schedule_slp_instance): Elide bst_map use.
	(vect_schedule_slp): Likewise.

	* g++.dg/vect/slp-pr92516.cc: New testcase.

2019-11-18  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (vect_analyze_slp_instance): When a CTOR
	was vectorized with just external refs fail.

	* gcc.dg/vect/vect-ctor-1.c: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/vect/slp-pr92516.cc
    trunk/gcc/testsuite/gcc.dg/vect/vect-ctor-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-slp.c
Comment 10 Richard Biener 2019-11-18 14:12:21 UTC
Fixed.