tree.h (avoid_folding_inline_builtin): New prototype.
authorJakub Jelinek <jakub@redhat.com>
Thu, 6 Oct 2011 14:34:48 +0000 (16:34 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 6 Oct 2011 14:34:48 +0000 (16:34 +0200)
* tree.h (avoid_folding_inline_builtin): New prototype.
* builtins.c (avoid_folding_inline_builtin): No longer static.
* gimple-fold.c (gimple_fold_builtin): Give up if
avoid_folding_inline_builtin returns true.

From-SVN: r179614

gcc/ChangeLog
gcc/builtins.c
gcc/gimple-fold.c
gcc/tree.h

index 74b1139225c6675119272e417fd30c5a79858f0c..445cf4affe0a2b6228adb73c94b4607370bd2c76 100644 (file)
@@ -1,3 +1,10 @@
+2011-10-06  Jakub Jelinek  <jakub@redhat.com>
+
+       * tree.h (avoid_folding_inline_builtin): New prototype.
+       * builtins.c (avoid_folding_inline_builtin): No longer static.
+       * gimple-fold.c (gimple_fold_builtin): Give up if
+       avoid_folding_inline_builtin returns true.
+
 2011-10-06  Richard Guenther  <rguenther@suse.de>
 
        * tree-vect-generic.c (vector_element): Look at previous
index 3055927f369c928c87c42d06f1c1d8c2ec47e8d5..8476b0e6b8b7d254d85f6c43b9ccba6b964d44b9 100644 (file)
@@ -10360,7 +10360,7 @@ fold_builtin_varargs (location_t loc, tree fndecl, tree exp,
    been inlined, otherwise e.g. -D_FORTIFY_SOURCE checking
    might not be performed.  */
 
-static bool
+bool
 avoid_folding_inline_builtin (tree fndecl)
 {
   return (DECL_DECLARED_INLINE_P (fndecl)
index fcfbcc8f5b332a00e9251cfaaa64ccdca786f12b..b4993fdef924f70d3bc0ce272d2da760b33269cc 100644 (file)
@@ -828,6 +828,11 @@ gimple_fold_builtin (gimple stmt)
   if (DECL_BUILT_IN_CLASS (callee) == BUILT_IN_MD)
     return NULL_TREE;
 
+  /* Give up for always_inline inline builtins until they are
+     inlined.  */
+  if (avoid_folding_inline_builtin (callee))
+    return NULL_TREE;
+
   /* If the builtin could not be folded, and it has no argument list,
      we're done.  */
   nargs = gimple_call_num_args (stmt);
index f064bbe30f5a94d0cdcb22da99bd20d1e043d4db..e0f1a075037f8e02837d93800f5214e4bcd574f9 100644 (file)
@@ -5352,6 +5352,7 @@ fold_build_pointer_plus_hwi_loc (location_t loc, tree ptr, HOST_WIDE_INT off)
        fold_build_pointer_plus_hwi_loc (UNKNOWN_LOCATION, p, o)
 
 /* In builtins.c */
+extern bool avoid_folding_inline_builtin (tree);
 extern tree fold_call_expr (location_t, tree, bool);
 extern tree fold_builtin_fputs (location_t, tree, tree, bool, bool, tree);
 extern tree fold_builtin_strcpy (location_t, tree, tree, tree, tree);