tree-ssa-loop-ivcanon.c (constant_after_peeling): Do not require sth as strict as a simple_iv but a chrec without symbols and an...

2016-04-21  Richard Biener  <rguenther@suse.de>

	* tree-ssa-loop-ivcanon.c (constant_after_peeling): Do not require
	sth as strict as a simple_iv but a chrec without symbols and an
	operand defined in the loop we are peeling (and not some subloop).
	(propagate_constants_for_unrolling): Propagate all constants.

	* gcc.dg/vect/no-scevccp-outer-13.c: Adjust to prevent unrolling
	of inner loops.
	* gcc.dg/vect/no-scevccp-outer-7.c: Likewise.
	* gcc.dg/vect/vect-104.c: Likewise.

From-SVN: r247048
This commit is contained in:
Richard Biener 2017-04-21 08:12:27 +00:00 committed by Richard Biener
parent 2f23a41208
commit 7fd1a7474a
6 changed files with 24 additions and 9 deletions

View File

@ -1,3 +1,10 @@
2016-04-21 Richard Biener <rguenther@suse.de>
* tree-ssa-loop-ivcanon.c (constant_after_peeling): Do not require
sth as strict as a simple_iv but a chrec without symbols and an
operand defined in the loop we are peeling (and not some subloop).
(propagate_constants_for_unrolling): Propagate all constants.
2017-04-20 Uros Bizjak <ubizjak@gmail.com> 2017-04-20 Uros Bizjak <ubizjak@gmail.com>
PR target/79804 PR target/79804

View File

@ -1,3 +1,10 @@
2016-04-21 Richard Biener <rguenther@suse.de>
* gcc.dg/vect/no-scevccp-outer-13.c: Adjust to prevent unrolling
of inner loops.
* gcc.dg/vect/no-scevccp-outer-7.c: Likewise.
* gcc.dg/vect/vect-104.c: Likewise.
2017-04-21 Eric Botcazou <ebotcazou@adacore.com> 2017-04-21 Eric Botcazou <ebotcazou@adacore.com>
PR tree-optimization/80426 PR tree-optimization/80426

View File

@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_int } */ /* { dg-require-effective-target vect_int } */
/* { dg-additional-options "--param max-completely-peel-times=1" } */
#include <stdarg.h> #include <stdarg.h>
#include "tree-vect.h" #include "tree-vect.h"

View File

@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_int } */ /* { dg-require-effective-target vect_int } */
/* { dg-additional-options "--param max-completely-peel-times=1" } */
#include <stdarg.h> #include <stdarg.h>
#include "tree-vect.h" #include "tree-vect.h"

View File

@ -1,4 +1,5 @@
/* { dg-require-effective-target vect_int } */ /* { dg-require-effective-target vect_int } */
/* { dg-additional-options "--param max-completely-peel-times=1" } */
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>

View File

@ -157,8 +157,6 @@ struct loop_size
static bool static bool
constant_after_peeling (tree op, gimple *stmt, struct loop *loop) constant_after_peeling (tree op, gimple *stmt, struct loop *loop)
{ {
affine_iv iv;
if (is_gimple_min_invariant (op)) if (is_gimple_min_invariant (op))
return true; return true;
@ -188,12 +186,12 @@ constant_after_peeling (tree op, gimple *stmt, struct loop *loop)
return false; return false;
} }
/* Induction variables are constants. */ /* Induction variables are constants when defined in loop. */
if (!simple_iv (loop, loop_containing_stmt (stmt), op, &iv, false)) if (loop_containing_stmt (stmt) != loop)
return false; return false;
if (!is_gimple_min_invariant (iv.base)) tree ev = analyze_scalar_evolution (loop, op);
return false; if (chrec_contains_undetermined (ev)
if (!is_gimple_min_invariant (iv.step)) || chrec_contains_symbols (ev))
return false; return false;
return true; return true;
} }
@ -1259,7 +1257,7 @@ propagate_constants_for_unrolling (basic_block bb)
if (! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (result) if (! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (result)
&& gimple_phi_num_args (phi) == 1 && gimple_phi_num_args (phi) == 1
&& TREE_CODE (arg) == INTEGER_CST) && CONSTANT_CLASS_P (arg))
{ {
replace_uses_by (result, arg); replace_uses_by (result, arg);
gsi_remove (&gsi, true); gsi_remove (&gsi, true);
@ -1276,7 +1274,7 @@ propagate_constants_for_unrolling (basic_block bb)
tree lhs; tree lhs;
if (is_gimple_assign (stmt) if (is_gimple_assign (stmt)
&& gimple_assign_rhs_code (stmt) == INTEGER_CST && TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)) == tcc_constant
&& (lhs = gimple_assign_lhs (stmt), TREE_CODE (lhs) == SSA_NAME) && (lhs = gimple_assign_lhs (stmt), TREE_CODE (lhs) == SSA_NAME)
&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
{ {