Commit 208cb8cb by Richard Guenther Committed by Richard Biener

re PR tree-optimization/48172 (incorrect vectorization of loop in GCC 4.5.* with -O3)

2011-05-13  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/48172
	* tree-vect-loop-manip.c (vect_vfa_segment_size): Avoid
	multiplying by number of iterations for equal step.
	(vect_create_cond_for_alias_checks): Likewise.

From-SVN: r173725
parent b88ecf55
2011-05-13 Richard Guenther <rguenther@suse.de>
PR tree-optimization/48172
* tree-vect-loop-manip.c (vect_vfa_segment_size): Avoid
multiplying by number of iterations for equal step.
(vect_create_cond_for_alias_checks): Likewise.
2011-05-13 Andreas Schwab <schwab@redhat.com> 2011-05-13 Andreas Schwab <schwab@redhat.com>
* configure.ac: Use AS_HELP_STRING throughout. * configure.ac: Use AS_HELP_STRING throughout.
......
...@@ -2353,23 +2353,18 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo, ...@@ -2353,23 +2353,18 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
Input: Input:
DR: The data reference. DR: The data reference.
VECT_FACTOR: vectorization factor. LENGTH_FACTOR: segment length to consider.
SCALAR_LOOP_NITERS: number of iterations.
Return an expression whose value is the size of segment which will be Return an expression whose value is the size of segment which will be
accessed by DR. */ accessed by DR. */
static tree static tree
vect_vfa_segment_size (struct data_reference *dr, int vect_factor, vect_vfa_segment_size (struct data_reference *dr, tree length_factor)
tree scalar_loop_niters)
{ {
tree segment_length; tree segment_length;
segment_length = size_binop (MULT_EXPR, segment_length = size_binop (MULT_EXPR,
fold_convert (sizetype, DR_STEP (dr)), fold_convert (sizetype, DR_STEP (dr)),
size_int (vect_factor)); fold_convert (sizetype, length_factor));
segment_length = size_binop (MULT_EXPR,
segment_length,
fold_convert (sizetype, scalar_loop_niters));
if (vect_supportable_dr_alignment (dr, false) if (vect_supportable_dr_alignment (dr, false)
== dr_explicit_realign_optimized) == dr_explicit_realign_optimized)
{ {
...@@ -2417,7 +2412,7 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo, ...@@ -2417,7 +2412,7 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo,
ddr_p ddr; ddr_p ddr;
unsigned int i; unsigned int i;
tree part_cond_expr; tree part_cond_expr, length_factor;
/* Create expression /* Create expression
((store_ptr_0 + store_segment_length_0) < load_ptr_0) ((store_ptr_0 + store_segment_length_0) < load_ptr_0)
...@@ -2465,10 +2460,12 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo, ...@@ -2465,10 +2460,12 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo,
vect_create_addr_base_for_vector_ref (stmt_b, cond_expr_stmt_list, vect_create_addr_base_for_vector_ref (stmt_b, cond_expr_stmt_list,
NULL_TREE, loop); NULL_TREE, loop);
segment_length_a = vect_vfa_segment_size (dr_a, vect_factor, if (!operand_equal_p (DR_STEP (dr_a), DR_STEP (dr_b), 0))
scalar_loop_iters); length_factor = scalar_loop_iters;
segment_length_b = vect_vfa_segment_size (dr_b, vect_factor, else
scalar_loop_iters); length_factor = size_int (vect_factor);
segment_length_a = vect_vfa_segment_size (dr_a, length_factor);
segment_length_b = vect_vfa_segment_size (dr_b, length_factor);
if (vect_print_dump_info (REPORT_DR_DETAILS)) if (vect_print_dump_info (REPORT_DR_DETAILS))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment