]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/fold-const-call.c
PR tree-optimization/78257 - missing memcmp optimization with constant arrays
[thirdparty/gcc.git] / gcc / fold-const-call.c
index c9e368db9d01b77a141c29056ed095a329cce7ac..11ed47db3d95b95da2cb4e42d95f1c7d41ed2544 100644 (file)
@@ -1800,8 +1800,8 @@ fold_const_call (combined_fn fn, tree type, tree arg0, tree arg1, tree arg2)
          && !TREE_SIDE_EFFECTS (arg0)
          && !TREE_SIDE_EFFECTS (arg1))
        return build_int_cst (type, 0);
-      if ((p0 = c_getstr (arg0, &s0))
-         && (p1 = c_getstr (arg1, &s1))
+      if ((p0 = getbyterep (arg0, &s0))
+         && (p1 = getbyterep (arg1, &s1))
          && s2 <= s0
          && s2 <= s1)
        return build_cmp_result (type, memcmp (p0, p1, s2));
@@ -1814,7 +1814,7 @@ fold_const_call (combined_fn fn, tree type, tree arg0, tree arg1, tree arg2)
          && !TREE_SIDE_EFFECTS (arg0)
          && !TREE_SIDE_EFFECTS (arg1))
        return build_int_cst (type, 0);
-      if ((p0 = c_getstr (arg0, &s0))
+      if ((p0 = getbyterep (arg0, &s0))
          && s2 <= s0
          && target_char_cst_p (arg1, &c))
        {