]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sccvn: Correct the index of bias for IFN_LEN_STORE [PR110744]
authorKewen Lin <linkw@linux.ibm.com>
Fri, 21 Jul 2023 05:18:19 +0000 (00:18 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Fri, 21 Jul 2023 05:18:19 +0000 (00:18 -0500)
Commit r14-2267-gb8806f6ffbe72e adjusts the arguments order
of LEN_STORE from {len,vector,bias} to {len,bias,vector},
in order to make them consistent with LEN_MASK_STORE and
MASK_STORE.  But it missed to update the related handlings
in tree-ssa-sccvn.cc, it caused the failure shown in PR
110744.  This patch is to fix the related handlings with
the correct index.

PR tree-optimization/110744

gcc/ChangeLog:

* tree-ssa-sccvn.cc (vn_reference_lookup_3): Correct the index of bias
operand for ifn IFN_LEN_STORE.

gcc/tree-ssa-sccvn.cc

index a0b98c18ac8af48fd86b976f26f703122eb566af..ebe8006bb8b0c9cd0fc2fe11d11222e0af9e9d8b 100644 (file)
@@ -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;
        }