aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-stmts.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-02-12 13:55:04 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-02-12 13:55:04 +0000
commit78604de064490c8c12d2d4efadbd453f7c8c7685 (patch)
tree41fce6fcdbb10087cd790b2c526e4f049acc8858 /gcc/tree-vect-stmts.c
parente1f30526731145b3d047c6eede48915ad36a0921 (diff)
downloadgcc-78604de064490c8c12d2d4efadbd453f7c8c7685.zip
gcc-78604de064490c8c12d2d4efadbd453f7c8c7685.tar.gz
gcc-78604de064490c8c12d2d4efadbd453f7c8c7685.tar.bz2
re PR tree-optimization/84037 (Speed regression of polyhedron benchmark since r256644)
2018-02-12 Richard Biener <rguenther@suse.de> PR tree-optimization/84037 * tree-vect-slp.c (vect_analyze_slp_cost): Add visited parameter, move visited init to caller. (vect_slp_analyze_operations): Separate cost from validity check, initialize visited once for all instances. (vect_schedule_slp): Analyze map to CSE vectorized nodes once for all instances. * tree-vect-stmts.c (vect_model_simple_cost): Make early out an assert. (vect_model_promotion_demotion_cost): Likewise. (vectorizable_bswap): Guard cost modeling with !slp_node instead of !PURE_SLP_STMT to avoid double-counting on hybrid SLP stmts. (vectorizable_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_assignment): Likewise. (vectorizable_shift): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vectorizable_condition): Likewise. (vectorizable_comparison): Likewise. From-SVN: r257588
Diffstat (limited to 'gcc/tree-vect-stmts.c')
-rw-r--r--gcc/tree-vect-stmts.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 6066a52..a98e0e5 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -826,8 +826,7 @@ vect_model_simple_cost (stmt_vec_info stmt_info, int ncopies,
int inside_cost = 0, prologue_cost = 0;
/* The SLP costs were already calculated during SLP tree build. */
- if (PURE_SLP_STMT (stmt_info))
- return;
+ gcc_assert (!PURE_SLP_STMT (stmt_info));
/* Cost the "broadcast" of a scalar operand in to a vector operand.
Use scalar_to_vec to cost the broadcast, as elsewhere in the vector
@@ -864,8 +863,7 @@ vect_model_promotion_demotion_cost (stmt_vec_info stmt_info,
void *target_cost_data;
/* The SLP costs were already calculated during SLP tree build. */
- if (PURE_SLP_STMT (stmt_info))
- return;
+ gcc_assert (!PURE_SLP_STMT (stmt_info));
if (loop_vinfo)
target_cost_data = LOOP_VINFO_TARGET_COST_DATA (loop_vinfo);
@@ -2891,7 +2889,7 @@ vectorizable_bswap (gimple *stmt, gimple_stmt_iterator *gsi,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location, "=== vectorizable_bswap ==="
"\n");
- if (! PURE_SLP_STMT (stmt_info))
+ if (! slp_node)
{
add_stmt_cost (stmt_info->vinfo->target_cost_data,
1, vector_stmt, stmt_info, 0, vect_prologue);
@@ -3210,10 +3208,13 @@ vectorizable_call (gimple *gs, gimple_stmt_iterator *gsi, gimple **vec_stmt,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location, "=== vectorizable_call ==="
"\n");
- vect_model_simple_cost (stmt_info, ncopies, dt, ndts, NULL, NULL);
- if (ifn != IFN_LAST && modifier == NARROW && !slp_node)
- add_stmt_cost (stmt_info->vinfo->target_cost_data, ncopies / 2,
- vec_promote_demote, stmt_info, 0, vect_body);
+ if (!slp_node)
+ {
+ vect_model_simple_cost (stmt_info, ncopies, dt, ndts, NULL, NULL);
+ if (ifn != IFN_LAST && modifier == NARROW && !slp_node)
+ add_stmt_cost (stmt_info->vinfo->target_cost_data, ncopies / 2,
+ vec_promote_demote, stmt_info, 0, vect_body);
+ }
return true;
}
@@ -4742,17 +4743,20 @@ vectorizable_conversion (gimple *stmt, gimple_stmt_iterator *gsi,
if (code == FIX_TRUNC_EXPR || code == FLOAT_EXPR)
{
STMT_VINFO_TYPE (stmt_info) = type_conversion_vec_info_type;
- vect_model_simple_cost (stmt_info, ncopies, dt, ndts, NULL, NULL);
+ if (!slp_node)
+ vect_model_simple_cost (stmt_info, ncopies, dt, ndts, NULL, NULL);
}
else if (modifier == NARROW)
{
STMT_VINFO_TYPE (stmt_info) = type_demotion_vec_info_type;
- vect_model_promotion_demotion_cost (stmt_info, dt, multi_step_cvt);
+ if (!slp_node)
+ vect_model_promotion_demotion_cost (stmt_info, dt, multi_step_cvt);
}
else
{
STMT_VINFO_TYPE (stmt_info) = type_promotion_vec_info_type;
- vect_model_promotion_demotion_cost (stmt_info, dt, multi_step_cvt);
+ if (!slp_node)
+ vect_model_promotion_demotion_cost (stmt_info, dt, multi_step_cvt);
}
interm_types.release ();
return true;
@@ -5149,7 +5153,8 @@ vectorizable_assignment (gimple *stmt, gimple_stmt_iterator *gsi,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"=== vectorizable_assignment ===\n");
- vect_model_simple_cost (stmt_info, ncopies, dt, ndts, NULL, NULL);
+ if (!slp_node)
+ vect_model_simple_cost (stmt_info, ncopies, dt, ndts, NULL, NULL);
return true;
}
@@ -5513,7 +5518,8 @@ vectorizable_shift (gimple *stmt, gimple_stmt_iterator *gsi,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"=== vectorizable_shift ===\n");
- vect_model_simple_cost (stmt_info, ncopies, dt, ndts, NULL, NULL);
+ if (!slp_node)
+ vect_model_simple_cost (stmt_info, ncopies, dt, ndts, NULL, NULL);
return true;
}
@@ -5836,7 +5842,8 @@ vectorizable_operation (gimple *stmt, gimple_stmt_iterator *gsi,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"=== vectorizable_operation ===\n");
- vect_model_simple_cost (stmt_info, ncopies, dt, ndts, NULL, NULL);
+ if (!slp_node)
+ vect_model_simple_cost (stmt_info, ncopies, dt, ndts, NULL, NULL);
return true;
}
@@ -6240,7 +6247,7 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
STMT_VINFO_TYPE (stmt_info) = store_vec_info_type;
/* The SLP costs are calculated during SLP analysis. */
- if (!PURE_SLP_STMT (stmt_info))
+ if (!slp_node)
vect_model_store_cost (stmt_info, ncopies, memory_access_type,
vls_type, NULL, NULL, NULL);
return true;
@@ -7451,7 +7458,7 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
STMT_VINFO_TYPE (stmt_info) = load_vec_info_type;
/* The SLP costs are calculated during SLP analysis. */
- if (!PURE_SLP_STMT (stmt_info))
+ if (! slp_node)
vect_model_load_cost (stmt_info, ncopies, memory_access_type,
NULL, NULL, NULL);
return true;
@@ -8673,7 +8680,8 @@ vectorizable_condition (gimple *stmt, gimple_stmt_iterator *gsi,
if (expand_vec_cond_expr_p (vectype, comp_vectype,
cond_code))
{
- vect_model_simple_cost (stmt_info, ncopies, dts, ndts, NULL, NULL);
+ if (!slp_node)
+ vect_model_simple_cost (stmt_info, ncopies, dts, ndts, NULL, NULL);
return true;
}
return false;
@@ -9037,8 +9045,9 @@ vectorizable_comparison (gimple *stmt, gimple_stmt_iterator *gsi,
if (!vec_stmt)
{
STMT_VINFO_TYPE (stmt_info) = comparison_vec_info_type;
- vect_model_simple_cost (stmt_info, ncopies * (1 + (bitop2 != NOP_EXPR)),
- dts, ndts, NULL, NULL);
+ if (!slp_node)
+ vect_model_simple_cost (stmt_info, ncopies * (1 + (bitop2 != NOP_EXPR)),
+ dts, ndts, NULL, NULL);
if (bitop1 == NOP_EXPR)
return expand_vec_cmp_expr_p (vectype, mask_type, code);
else