This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: optimise call graph for coverage data


Hi Richard

> This looks good with ...

Thanks for the review!

>   fndecl = get_callee_fndecl (call);
> 
>   if (fndecl
>       && DECL_BUILT_IN (fndecl)

Done.

> and either combining the bit-tests or caching the result of call_expr_flags.

I opted to cache the result of call_expr_flags.  Here is what I am now
committing (re-tested this morning with a full bootstrap and regression
test on powerpc64-linux).

Cheers, Ben

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.

Index: tree-cfg.c
===================================================================
--- tree-cfg.c  (revision 133928)
+++ tree-cfg.c  (working copy)
@@ -6420,7 +6420,8 @@ tree_block_ends_with_condjump_p (const_b
 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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]