]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/106403 - fix ICE with VN of .STORE_LANES
authorRichard Biener <rguenther@suse.de>
Fri, 22 Jul 2022 08:13:06 +0000 (10:13 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 22 Jul 2022 08:15:23 +0000 (10:15 +0200)
While .STORE_LANES is not supported by the recent VN patch we were
still accessing the stored value and valueizing it - but
internal_fn_stored_value_index does not support .STORE_LANES and
we failed to honor that case.  Fixed by simply moving the affected
code below the check for the actual supported internal functions.

PR tree-optimization/106403
* tree-ssa-sccvn.cc (vn_reference_lookup_3): Move stored
value valueization after check for IFN_MASKED_STORE or
IFN_LEN_STORE.

gcc/tree-ssa-sccvn.cc

index 7d947b55a2780f07a5fd5f7eacec3d44ab6db9d0..a1f6f30960980cfeb88ee24e4be7343c0852edea 100644 (file)
@@ -3221,11 +3221,6 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
     {
       gcall *call = as_a <gcall *> (def_stmt);
       internal_fn fn = gimple_call_internal_fn (call);
-      tree def_rhs = gimple_call_arg (call,
-                                     internal_fn_stored_value_index (fn));
-      def_rhs = vn_valueize (def_rhs);
-      if (TREE_CODE (def_rhs) != VECTOR_CST)
-       return (void *)-1;
 
       tree mask = NULL_TREE, len = NULL_TREE, bias = NULL_TREE;
       switch (fn)
@@ -3245,6 +3240,12 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
        default:
          return (void *)-1;
        }
+      tree def_rhs = gimple_call_arg (call,
+                                     internal_fn_stored_value_index (fn));
+      def_rhs = vn_valueize (def_rhs);
+      if (TREE_CODE (def_rhs) != VECTOR_CST)
+       return (void *)-1;
+
       ao_ref_init_from_ptr_and_size (&lhs_ref,
                                     vn_valueize (gimple_call_arg (call, 0)),
                                     TYPE_SIZE_UNIT (TREE_TYPE (def_rhs)));