tree-cfg.c (need_fake_edge_p): Return false for calls to builtins that return exactly...
authorBen Elliston <bje@au.ibm.com>
Sat, 5 Apr 2008 03:50:18 +0000 (03:50 +0000)
committerBen Elliston <bje@gcc.gnu.org>
Sat, 5 Apr 2008 03:50:18 +0000 (14:50 +1100)
* tree-cfg.c (need_fake_edge_p): Return false for calls to
builtins that return exactly once and do not throw. Cache call to
call_expr_flags.

From-SVN: r133929

gcc/ChangeLog
gcc/tree-cfg.c

index a1a95f991af7c019eb14e32eae2623c4b1f8f481..d12cf3d5f51fcf6de31e3a2c4b120b17b06ce227 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-05  Ben Elliston  <bje@au.ibm.com>
+
+       * tree-cfg.c (need_fake_edge_p): Return false for calls to
+       builtins that return exactly once and do not throw. Cache call to
+       call_expr_flags.
+
 2008-04-04 Andy Hutchinson <hutchinsonandy@aim.com>
 
        PR rtl-optimization/34916
index 7eea2e1f07a6bff1dd4199f27b1b91f555b706ae..cf2001faae3df1723201cf84b536c664c0038389 100644 (file)
@@ -6420,7 +6420,8 @@ tree_block_ends_with_condjump_p (const_basic_block bb)
 static bool
 need_fake_edge_p (tree t)
 {
-  tree call;
+  tree call, fndecl = NULL_TREE;
+  int call_flags;
 
   /* NORETURN and LONGJMP calls already have an edge to exit.
      CONST and PURE calls do not need one.
@@ -6430,8 +6431,19 @@ need_fake_edge_p (tree t)
      the counter incrementation code from -fprofile-arcs
      leads to different results from -fbranch-probabilities.  */
   call = get_call_expr_in (t);
-  if (call
-      && !(call_expr_flags (call) & ECF_NORETURN))
+  if (call)
+    {
+      fndecl = get_callee_fndecl (call);
+      call_flags = call_expr_flags (call);
+    }
+
+  if (call && fndecl && DECL_BUILT_IN (fndecl)
+      && (call_flags & ECF_NOTHROW)
+      && !(call_flags & ECF_NORETURN)
+      && !(call_flags & ECF_RETURNS_TWICE))
+   return false;
+
+  if (call && !(call_flags & ECF_NORETURN))
     return true;
 
   if (TREE_CODE (t) == ASM_EXPR