https://gcc.gnu.org/g:9a8d91219d65f7cb304b1d678957f95061bfe02b

commit r16-2437-g9a8d91219d65f7cb304b1d678957f95061bfe02b
Author: Richard Biener <rguent...@suse.de>
Date:   Tue Jul 22 15:04:16 2025 +0200

    [aarch64] check for non-NULL vectype in aarch64_vector_costs::add_stmt_cost
    
    With a patch still in development we get NULL STMT_VINFO_VECTYPE.
    One side-effect is that during scalar stmt testing we no longer
    pass a vectype.  The following adjusts aarch64_vector_costs::add_stmt_cost
    to check for a non-NULL vectype before accessing it, like all the
    code surrounding it.  The other fix possibility would have been
    to re-orderr the check with the vect_mem_access_type one, but that
    one is not going to exist during scalar code costing either in the
    future.
    
            * config/aarch64/aarch64.cc (aarch64_vector_costs::add_stmt_cost):
            Check vectype is non-NULL before accessing it.

Diff:
---
 gcc/config/aarch64/aarch64.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 72a691b8e2f2..9e4a37bcaff0 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -17976,6 +17976,7 @@ aarch64_vector_costs::add_stmt_cost (int count, 
vect_cost_for_stmt kind,
 
       /* Check if we've seen an SVE gather/scatter operation and which size.  
*/
       if (kind == scalar_load
+         && vectype
          && aarch64_sve_mode_p (TYPE_MODE (vectype))
          && vect_mem_access_type (stmt_info, node) == VMAT_GATHER_SCATTER)
        {

Reply via email to