OSDN Git Service

* tree.h (avoid_folding_inline_builtin): New prototype.
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Oct 2011 19:57:52 +0000 (19:57 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Oct 2011 19:57:52 +0000 (19:57 +0000)
* builtins.c (avoid_folding_inline_builtin): No longer static.
* gimple-fold.c (gimple_fold_builtin): Give up if
avoid_folding_inline_builtin returns true.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@179635 138bc75d-0d04-0410-961f-82ee72b054a4

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

index b463825..e9b45d2 100644 (file)
@@ -1,5 +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.
+
        PR tree-optimization/49279
        * tree-ssa-structalias.c (find_func_aliases): Don't handle
        CAST_RESTRICT.
index 8576765..fd99611 100644 (file)
@@ -10760,7 +10760,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 811e485..ad45dcb 100644 (file)
@@ -1210,6 +1210,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 0bad048..ece68b4 100644 (file)
@@ -5139,6 +5139,7 @@ truth_value_p (enum tree_code code)
 
 
 /* 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);