Bug 52686 - SLP crashes with WIDEN_LSHIFT_EXPR
Summary: SLP crashes with WIDEN_LSHIFT_EXPR
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Ulrich Weigand
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-23 15:37 UTC by Ulrich Weigand
Modified: 2012-03-26 13:16 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-03-23 00:00:00


Attachments
Handle WIDEN_LSHIFT_EXPR in vect_get_smallest_scalar_type (241 bytes, patch)
2012-03-23 15:42 UTC, Ulrich Weigand
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Weigand 2012-03-23 15:37:13 UTC
When building the following test case:

unsigned int output[4];

void test (unsigned short *p)
{
  unsigned int x = *p;
  if (x)
    {
      output[0] = x << 1;
      output[1] = x << 1;
      output[2] = x << 1;
      output[3] = x << 1;
    }
}

GCC crashes with various symptoms (segmentation fault if checking is disabled; assertion failures along the lines of "vector VEC(tree,base) index domain error, in vect_create_vectorized_promotion_stmts at tree-vect-stmts.c:2130" if checking is enabled) when building on ARM with -O1 -ftree-vectorize -mfpu=neon -mfloat-abi=softfp.
Comment 1 Ulrich Weigand 2012-03-23 15:38:43 UTC
It seems the root cause of all the memory problems is that vect_get_smallest_scalar_type neglects to handle WIDEN_LSHIFT_EXPR, which causes the SLP pass to mis-compute the number of statements needed to vectorize the expression.
Comment 2 Ulrich Weigand 2012-03-23 15:42:00 UTC
Created attachment 26968 [details]
Handle WIDEN_LSHIFT_EXPR in vect_get_smallest_scalar_type

The attached patch fixes the ICEs for me.
Comment 3 Ulrich Weigand 2012-03-26 13:13:14 UTC
Author: uweigand
Date: Mon Mar 26 13:13:07 2012
New Revision: 185795

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185795
Log:
	gcc/
	PR tree-optimization/52686
	* tree-vect-data-refs.c (vect_get_smallest_scalar_type): Handle
	WIDEN_LSHIFT_EXPR.

	gcc/testsuite/
	PR tree-optimization/52686
	* gcc.target/arm/pr52686.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/arm/pr52686.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-data-refs.c
Comment 4 Ulrich Weigand 2012-03-26 13:16:30 UTC
Fixed.