re PR tree-optimization/83867 (ICE: Segmentation fault in nested_in_vect_loop_p)

2018-01-16  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/83867
	* tree-vect-stmts.c (vect_transform_stmt): Precompute
	nested_in_vect_loop_p since the scalar stmt may get invalidated.

	* gcc.dg/vect/pr83867.c: New testcase.

From-SVN: r256746
This commit is contained in:
Richard Biener 2018-01-16 15:13:05 +00:00 committed by Richard Biener
parent 38943500ba
commit e57d9a8299
4 changed files with 37 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2018-01-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/83867
* tree-vect-stmts.c (vect_transform_stmt): Precompute
nested_in_vect_loop_p since the scalar stmt may get invalidated.
2018-01-16 Jakub Jelinek <jakub@redhat.com> 2018-01-16 Jakub Jelinek <jakub@redhat.com>
PR c/83844 PR c/83844

View File

@ -1,3 +1,8 @@
2018-01-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/83867
* gcc.dg/vect/pr83867.c: New testcase.
2018-01-16 Jakub Jelinek <jakub@redhat.com> 2018-01-16 Jakub Jelinek <jakub@redhat.com>
PR c/83844 PR c/83844

View File

@ -0,0 +1,20 @@
/* { dg-do compile } */
/* { dg-additional-options "-O -ftrapv" } */
int
k5 (int u5, int aw)
{
int v6;
while (u5 < 1)
{
while (v6 < 4)
++v6;
v6 = 0;
aw += u5 > 0;
++u5;
}
return aw;
}

View File

@ -9426,6 +9426,11 @@ vect_transform_stmt (gimple *stmt, gimple_stmt_iterator *gsi,
gcc_assert (slp_node || !PURE_SLP_STMT (stmt_info)); gcc_assert (slp_node || !PURE_SLP_STMT (stmt_info));
gimple *old_vec_stmt = STMT_VINFO_VEC_STMT (stmt_info); gimple *old_vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
bool nested_p = (STMT_VINFO_LOOP_VINFO (stmt_info)
&& nested_in_vect_loop_p
(LOOP_VINFO_LOOP (STMT_VINFO_LOOP_VINFO (stmt_info)),
stmt));
switch (STMT_VINFO_TYPE (stmt_info)) switch (STMT_VINFO_TYPE (stmt_info))
{ {
case type_demotion_vec_info_type: case type_demotion_vec_info_type:
@ -9525,9 +9530,7 @@ vect_transform_stmt (gimple *stmt, gimple_stmt_iterator *gsi,
/* Handle inner-loop stmts whose DEF is used in the loop-nest that /* Handle inner-loop stmts whose DEF is used in the loop-nest that
is being vectorized, but outside the immediately enclosing loop. */ is being vectorized, but outside the immediately enclosing loop. */
if (vec_stmt if (vec_stmt
&& STMT_VINFO_LOOP_VINFO (stmt_info) && nested_p
&& nested_in_vect_loop_p (LOOP_VINFO_LOOP (
STMT_VINFO_LOOP_VINFO (stmt_info)), stmt)
&& STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type && STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type
&& (STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_outer && (STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_outer
|| STMT_VINFO_RELEVANT (stmt_info) == || STMT_VINFO_RELEVANT (stmt_info) ==