------- Comment #4 from dorit at gcc dot gnu dot org 2007-12-16 13:06 ------- testing this patch:
*** tree-vect-transform.c (revision 130987) --- tree-vect-transform.c (working copy) *************** vect_estimate_min_profitable_iters (loop *** 197,214 **** factor = 1; for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si)) ! { ! tree stmt = bsi_stmt (si); ! stmt_vec_info stmt_info = vinfo_for_stmt (stmt); ! if (!STMT_VINFO_RELEVANT_P (stmt_info) ! && !STMT_VINFO_LIVE_P (stmt_info)) ! continue; ! scalar_single_iter_cost += cost_for_stmt (stmt) * factor; ! vec_inside_cost += STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info) * factor; /* FIXME: for stmts in the inner-loop in outer-loop vectorization, some of the "outside" costs are generated inside the outer-loop. */ ! vec_outside_cost += STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info); ! } } /* Add additional cost for the peeled instructions in prologue and epilogue --- 197,215 ---- factor = 1; for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si)) ! { ! tree stmt = bsi_stmt (si); ! stmt_vec_info stmt_info = vinfo_for_stmt (stmt); ! /* Skip stmts that are not vectorized inside the loop. */ ! if (!STMT_VINFO_RELEVANT_P (stmt_info) ! && STMT_VINFO_DEF_TYPE (stmt_info) != vect_reduction_def) ! continue; ! scalar_single_iter_cost += cost_for_stmt (stmt) * factor; ! vec_inside_cost += STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info) * factor; /* FIXME: for stmts in the inner-loop in outer-loop vectorization, some of the "outside" costs are generated inside the outer-loop. */ ! vec_outside_cost += STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info); ! } } /* Add additional cost for the peeled instructions in prologue and epilogue (It fixes both testcases) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34445