If strchr can't be folded in gimple-fold...
authorWilco Dijkstra <wdijkstr@arm.com>
Wed, 28 Sep 2016 16:31:34 +0000 (16:31 +0000)
committerWilco Dijkstra <wilco@gcc.gnu.org>
Wed, 28 Sep 2016 16:31:34 +0000 (16:31 +0000)
If strchr can't be folded in gimple-fold, we still need to fall into
the generic code so the folding code in builtins.c is also called.

    gcc/
* gimple-fold.c (gimple_fold_builtin): After failing to fold
strchr, also try the generic folding.

From-SVN: r240585

gcc/ChangeLog
gcc/gimple-fold.c

index 194c9bf026c3d9be7fec70b3cecad1b4caf959de..4c02c9d654bcb65875a5e15d05597eb6a2928543 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-28  Wilco Dijkstra  <wdijkstr@arm.com>
+
+       * gimple-fold.c (gimple_fold_builtin): After failing to fold
+       strchr, also try the generic folding.
+
 2016-09-28  Martin Sebor  <msebor@redhat.com>
 
        PR c/77762
index f5a5e5db2830d4f7ecc05084b488f16c3d67f3fb..1aae8456bc81c0291ebcf136ad5c70fde2e711a5 100644 (file)
@@ -2948,7 +2948,10 @@ gimple_fold_builtin (gimple_stmt_iterator *gsi)
     case BUILT_IN_STRNCAT:
       return gimple_fold_builtin_strncat (gsi);
     case BUILT_IN_STRCHR:
-      return gimple_fold_builtin_strchr (gsi);
+      if (gimple_fold_builtin_strchr (gsi))
+       return true;
+      /* Perform additional folding in builtin.c.  */
+      break;
     case BUILT_IN_FPUTS:
       return gimple_fold_builtin_fputs (gsi, gimple_call_arg (stmt, 0),
                                        gimple_call_arg (stmt, 1), false);