After removing STMT_VINFO_MEMORY_ACCESS_TYPE we now ICE when costing
for scalar stmts required in the epilog since the cost model tries
to pattern-match gathers (an earlier patch tried to improve this
by introducing stmt groups, but that was on hold due to negative
feedback). The following shot-cuts those attempts when node is NULL
as that then cannot be a vector stmt. Another possibility would be
to gate on vect_body, or restructure everything.
Note we now ensure that when m_costing_for_scalar node is NULL.
* config/aarch64/aarch64.cc (aarch64_detect_vector_stmt_subtype):
Check for node before dereferencing.
(aarch64_vector_costs::add_stmt_cost): Likewise.
for each element. We therefore need to divide the full-instruction
cost by the number of elements in the vector. */
if (kind == scalar_load
+ && node
&& sve_costs
&& SLP_TREE_MEMORY_ACCESS_TYPE (node) == VMAT_GATHER_SCATTER)
{
/* Detect cases in which a scalar_store is really storing one element
in a scatter operation. */
if (kind == scalar_store
+ && node
&& sve_costs
&& SLP_TREE_MEMORY_ACCESS_TYPE (node) == VMAT_GATHER_SCATTER)
return sve_costs->scatter_store_elt_cost;
/* Check if we've seen an SVE gather/scatter operation and which size. */
if (kind == scalar_load
- && !m_costing_for_scalar
+ && node
&& vectype
&& aarch64_sve_mode_p (TYPE_MODE (vectype))
&& SLP_TREE_MEMORY_ACCESS_TYPE (node) == VMAT_GATHER_SCATTER)