https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110744

--- Comment #6 from Kewen Lin <linkw at gcc dot gnu.org> ---
The root cause is that the length and bias handling about LEN_STORE in sccvn
was missed to be updated, the below diff can fix the failure.

diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index 11061a374a2..c0b3ec420c5 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -3299,11 +3299,14 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void
*data_,
            return (void *)-1;
          break;
        case IFN_LEN_STORE:
-         len = gimple_call_arg (call, 2);
-         bias = gimple_call_arg (call, 4);
-         if (!tree_fits_uhwi_p (len) || !tree_fits_shwi_p (bias))
-           return (void *)-1;
-         break;
+         {
+           int len_index = internal_fn_len_index (fn);
+           len = gimple_call_arg (call, len_index);
+           bias = gimple_call_arg (call, len_index + 1);
+           if (!tree_fits_uhwi_p (len) || !tree_fits_shwi_p (bias))
+             return (void *) -1;
+           break;
+         }
        default:
          return (void *)-1;
        }

Fully testing it.

Reply via email to