2 /* { dg-options "-O2 -fdump-tree-strlen" } */
6 __attribute__((noinline
, noclone
)) char *
10 if (strlen (p
) + strlen (r
) + 9 > 26)
12 /* This strcpy can be optimized into memcpy, using the remembered
15 /* These two strcat can be optimized into memcpy. The first one
16 could be even optimized into a *ptr = '/'; store as the '\0'
17 is immediately overwritten. */
19 strcat (buf
, "abcde");
20 /* This strcpy can be optimized into memcpy, using the remembered
23 /* And this can be optimized into memcpy too. */
31 char *volatile p
= "string1";
32 char *volatile r
= "string2";
36 if (strcmp (q
, "string1/abcdestring2fg"))
43 /* { dg-final { scan-tree-dump-times "strlen \\(" 2 "strlen" } } */
44 /* { dg-final { scan-tree-dump-times "memcpy \\(" 5 "strlen" } } */
45 /* { dg-final { scan-tree-dump-times "strcpy \\(" 0 "strlen" } } */
46 /* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" } } */
47 /* { dg-final { scan-tree-dump-times "strchr \\(" 0 "strlen" } } */
48 /* { dg-final { scan-tree-dump-times "stpcpy \\(" 0 "strlen" } } */