The following makes sure to read from the lanes_ifn member only
when necessary (and thus it was set).

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

        * tree-vect-stmts.cc (vectorizable_store): Access lanes_ifn
        only when VMAT_LOAD_STORE_LANES.
        (vectorizable_load): Likewise.
---
 gcc/tree-vect-stmts.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index fb595769038..92e7326dbfc 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -7895,7 +7895,6 @@ vectorizable_store (vec_info *vinfo,
     = ls.alignment_support_scheme;
   const int misalignment = ls.misalignment;
   const poly_int64 poffset = ls.poffset;
-  const internal_fn lanes_ifn = ls.lanes_ifn;
 
   if (slp_node->ldst_lanes
       && memory_access_type != VMAT_LOAD_STORE_LANES)
@@ -8399,6 +8398,8 @@ vectorizable_store (vec_info *vinfo,
 
   if (memory_access_type == VMAT_LOAD_STORE_LANES)
     {
+      const internal_fn lanes_ifn = ls.lanes_ifn;
+
       if (costing_p)
        /* Update all incoming store operand nodes, the general handling
           above only handles the mask and the first store operand node.  */
@@ -9464,7 +9465,6 @@ vectorizable_load (vec_info *vinfo,
     = ls.alignment_support_scheme;
   const int misalignment = ls.misalignment;
   const poly_int64 poffset = ls.poffset;
-  const internal_fn lanes_ifn = ls.lanes_ifn;
   const vec<int> &elsvals = ls.elsvals;
 
   int maskload_elsval = 0;
@@ -10245,6 +10245,8 @@ vectorizable_load (vec_info *vinfo,
   tree vec_els = NULL_TREE;
   if (memory_access_type == VMAT_LOAD_STORE_LANES)
     {
+      const internal_fn lanes_ifn = ls.lanes_ifn;
+
       gcc_assert (alignment_support_scheme == dr_aligned
                  || alignment_support_scheme == dr_unaligned_supported);
 
-- 
2.43.0

Reply via email to