"incompatible vector types for invariants\n");
return false;
}
- record_stmt_cost (cost_vec, SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node),
- vector_stmt, stmt_info, vectype, 0, vect_body);
+ /* For single-argument PHIs assume coalescing which means zero cost
+ for the scalar and the vector PHIs. This avoids artificially
+ favoring the vector path (but may pessimize it in some cases). */
+ if (gimple_phi_num_args (as_a <gphi *> (stmt_info->stmt)) > 1)
+ record_stmt_cost (cost_vec, SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node),
+ vector_stmt, stmt_info, vectype, 0, vect_body);
STMT_VINFO_TYPE (stmt_info) = phi_info_type;
return true;
}
}
else if (vect_nop_conversion_p (orig_stmt_info))
continue;
+ /* For single-argument PHIs assume coalescing which means zero cost
+ for the scalar and the vector PHIs. This avoids artificially
+ favoring the vector path (but may pessimize it in some cases). */
+ else if (is_a <gphi *> (orig_stmt_info->stmt)
+ && gimple_phi_num_args
+ (as_a <gphi *> (orig_stmt_info->stmt)) == 1)
+ continue;
else
kind = scalar_stmt;
record_stmt_cost (cost_vec, 1, kind, orig_stmt_info,
STMT_VINFO_TYPE (stmt_info) = call_vec_info_type;
DUMP_VECT_SCOPE ("vectorizable_bswap");
- if (! slp_node)
- {
- record_stmt_cost (cost_vec,
- 1, vector_stmt, stmt_info, 0, vect_prologue);
- record_stmt_cost (cost_vec,
- ncopies, vec_perm, stmt_info, 0, vect_body);
- }
+ record_stmt_cost (cost_vec,
+ 1, vector_stmt, stmt_info, 0, vect_prologue);
+ record_stmt_cost (cost_vec,
+ slp_node
+ ? SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node) : ncopies,
+ vec_perm, stmt_info, 0, vect_body);
return true;
}