On Mon, Jan 20, 2014 at 11:54:15AM +0100, Richard Biener wrote: > Ok, the following simpler patch also fixes the issue and causes > no testsuite fallout - we restrict the folding in builtins.c to > the case with known src strlen.
I've noticed this caused FAIL of strlenopt-4.c which had special regexps for s390* vs. other targets because of the HAVE_movstr case. Fixed thusly, committed as obvious to trunk/4.8: 2014-01-21 Jakub Jelinek <ja...@redhat.com> PR middle-end/59860 * gcc.dg/strlenopt-4.c: Expect the same counts on s390*-* as on all other targets. --- gcc/testsuite/gcc.dg/strlenopt-4.c.jj 2011-10-26 14:19:07.000000000 +0200 +++ gcc/testsuite/gcc.dg/strlenopt-4.c 2014-01-21 08:17:03.746157021 +0100 @@ -66,16 +66,10 @@ main () return 0; } -/* For targets providing a movstr pattern strcat is already decomposed - into strlen + strcpy by fold_builtin_strcat. */ - -/* { dg-final { scan-tree-dump-times "strlen \\(" 3 "strlen" { target { ! s390*-*-* } } } } */ -/* { dg-final { scan-tree-dump-times "strlen \\(" 6 "strlen" { target s390*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "strlen \\(" 3 "strlen" } } */ /* { dg-final { scan-tree-dump-times "memcpy \\(" 4 "strlen" } } */ -/* { dg-final { scan-tree-dump-times "strcpy \\(" 3 "strlen" { target { ! s390*-*-* } } } } */ -/* { dg-final { scan-tree-dump-times "strcpy \\(" 6 "strlen" { target s390*-*-* } } } */ -/* { dg-final { scan-tree-dump-times "strcat \\(" 3 "strlen" { target { ! s390*-*-* } } } } */ -/* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" { target s390*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "strcpy \\(" 3 "strlen" } } */ +/* { dg-final { scan-tree-dump-times "strcat \\(" 3 "strlen" } } */ /* { dg-final { scan-tree-dump-times "strchr \\(" 0 "strlen" } } */ /* { dg-final { scan-tree-dump-times "stpcpy \\(" 0 "strlen" } } */ /* { dg-final { cleanup-tree-dump "strlen" } } */ Jakub