Bug 52870 - ICE during SLP pattern matching
Summary: ICE during SLP pattern matching
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Ulrich Weigand
URL:
Keywords:
: 52639 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-04-04 15:53 UTC by Ulrich Weigand
Modified: 2012-05-04 14:56 UTC (History)
1 user (show)

See Also:
Host:
Target: x86_64-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-04-04 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Weigand 2012-04-04 15:53:26 UTC
Building the following testcase with -O -ftree-vectorize on x86_64:

long
test (int *x)
{
  unsigned long sx, xprec;

  sx = *x >= 0 ? *x : -*x;

  xprec = sx * 64;

  if (sx < 16384)
    foo (sx);

  return xprec;
}


results in an ICE:

crash1.c:5:1: internal compiler error: vector VEC(vec_void_p,base) index domain error, in vinfo_for_stmt at tree-vectorizer.h:628

(When building with --disable-checking, we get a segmentation fault instead.)
Comment 1 Ulrich Weigand 2012-04-04 15:56:06 UTC
It seems the problem is that vect_recog_widen_mult_pattern includes a statement into a pattern it detects which is actually outside of the basic block that SLP is currently operating on.  This later on causes the ICE since the statement does not have an assigned stmt_vinfo.

I'm testing a fix.
Comment 2 Ulrich Weigand 2012-04-06 18:31:58 UTC
Patch posted:
http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00360.html
Comment 3 Ulrich Weigand 2012-04-10 10:56:17 UTC
Author: uweigand
Date: Tue Apr 10 10:56:11 2012
New Revision: 186272

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186272
Log:
	gcc/
	PR tree-optimization/52870
	* tree-vect-patterns.c (vect_recog_widen_mult_pattern): Verify that
	presumed pattern statement is within the same loop or basic block.

	gcc/testsuite/
	PR tree-optimization/52870
	* gcc.dg/vect/pr52870.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr52870.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-patterns.c
Comment 4 Ulrich Weigand 2012-04-10 10:58:25 UTC
Fixed.
Comment 5 Paolo Carlini 2012-04-25 00:17:23 UTC
*** Bug 52639 has been marked as a duplicate of this bug. ***
Comment 6 Ulrich Weigand 2012-05-04 14:56:52 UTC
Author: uweigand
Date: Fri May  4 14:56:48 2012
New Revision: 187162

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187162
Log:
2012-05-04  Ulrich Weigand  <ulrich.weigand@linaro.org>
 
 	Backport from mainline:
 
 	2012-05-04  Ulrich Weigand  <ulrich.weigand@linaro.org>
 
 	PR tree-optimization/52633
 	* tree-vect-patterns.c (vect_vect_recog_func_ptrs): Swap order of
 	vect_recog_widen_shift_pattern and vect_recog_over_widening_pattern.
 	(vect_recog_over_widening_pattern): Remove handling of code that was
 	already detected as over-widening pattern.  Remove special handling
 	of "unsigned" cases.  Instead, support general case of conversion
 	of the shift result to another type.
 
 	2012-05-04  Ulrich Weigand  <ulrich.weigand@linaro.org>
 
 	* tree-vect-patterns.c (vect_single_imm_use): New function.
 	(vect_recog_widen_mult_pattern): Use it instead of open-coding loop.
 	(vect_recog_over_widening_pattern): Likewise.
 	(vect_recog_widen_shift_pattern): Likewise.
 
 	2012-04-10  Ulrich Weigand  <ulrich.weigand@linaro.org>
 
 	PR tree-optimization/52870
 	* tree-vect-patterns.c (vect_recog_widen_mult_pattern): Verify that
 	presumed pattern statement is within the same loop or basic block.
 
2012-05-04  Ulrich Weigand  <ulrich.weigand@linaro.org>
 
 	Backport from mainline:
 
 	2012-05-04  Ulrich Weigand  <ulrich.weigand@linaro.org>
 
 	PR tree-optimization/52633
 	* gcc.dg/vect/vect-over-widen-1.c: Two patterns should now be
 	recognized as widening shifts instead of over-widening.
 	* gcc.dg/vect/vect-over-widen-1-big-array.c: Likewise.
 	* gcc.dg/vect/vect-over-widen-4.c: Likewise.
 	* gcc.dg/vect/vect-over-widen-4-big-array.c: Likewise.
 	* gcc.target/arm/pr52633.c: New test.
 
 	2012-04-10  Ulrich Weigand  <ulrich.weigand@linaro.org>
 
 	PR tree-optimization/52870
 	* gcc.dg/vect/pr52870.c: New test.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/vect/pr52870.c
    branches/gcc-4_7-branch/gcc/testsuite/gcc.target/arm/pr52633.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/vect/vect-over-widen-1-big-array.c
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/vect/vect-over-widen-4-big-array.c
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c
    branches/gcc-4_7-branch/gcc/tree-vect-patterns.c