]> gcc.gnu.org Git - gcc.git/commitdiff
cgraphbuild.c (build_cgraph_edges, [...]): Don't call initialize_inline_failed.
authorAdam Nemet <anemet@caviumnetworks.com>
Sun, 29 Mar 2009 00:08:07 +0000 (00:08 +0000)
committerAdam Nemet <nemet@gcc.gnu.org>
Sun, 29 Mar 2009 00:08:07 +0000 (00:08 +0000)
* cgraphbuild.c (build_cgraph_edges, rebuild_cgraph_edges): Don't
call initialize_inline_failed.
(initialize_inline_failed): Move it from here ...
* cgraph.c (initialize_inline_failed): ... to here.
(cgraph_create_edge): Call initialize_inline_failed rather than
setting inline_failed directly.

testsuite/
* gcc.dg/winline-10.c: New test.

From-SVN: r145215

gcc/ChangeLog
gcc/cgraph.c
gcc/cgraphbuild.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/winline-10.c [new file with mode: 0644]

index 46b558506c2f3b7073368b03ec474f5f74b91f5a..9ee7de8e7098f4e2c9142b13f30993814d0d9d72 100644 (file)
@@ -1,3 +1,12 @@
+2009-03-28  Adam Nemet  <anemet@caviumnetworks.com>
+
+       * cgraphbuild.c (build_cgraph_edges, rebuild_cgraph_edges): Don't
+       call initialize_inline_failed.
+       (initialize_inline_failed): Move it from here ...
+       * cgraph.c (initialize_inline_failed): ... to here.
+       (cgraph_create_edge): Call initialize_inline_failed rather than
+       setting inline_failed directly.
+
 2009-03-29  Ben Elliston  <bje@au.ibm.com>
 
        PR target/32542
index 8eb0381d2bea1600d502626f1cf8028850d18b64..d5dba426b1ab4f07294d4deaeb064bdd316371c8 100644 (file)
@@ -652,6 +652,26 @@ cgraph_set_call_stmt (struct cgraph_edge *e, gimple new_stmt)
     }
 }
 
+/* Give initial reasons why inlining would fail on EDGE.  This gets either
+   nullified or usually overwritten by more precise reasons later.  */
+
+static void
+initialize_inline_failed (struct cgraph_edge *e)
+{
+  struct cgraph_node *callee = e->callee;
+
+  if (!callee->analyzed)
+    e->inline_failed = CIF_BODY_NOT_AVAILABLE;
+  else if (callee->local.redefined_extern_inline)
+    e->inline_failed = CIF_REDEFINED_EXTERN_INLINE;
+  else if (!callee->local.inlinable)
+    e->inline_failed = CIF_FUNCTION_NOT_INLINABLE;
+  else if (gimple_call_cannot_inline_p (e->call_stmt))
+    e->inline_failed = CIF_MISMATCHED_ARGUMENTS;
+  else
+    e->inline_failed = CIF_FUNCTION_NOT_CONSIDERED;
+}
+
 /* Create edge from CALLER to CALLEE in the cgraph.  */
 
 struct cgraph_edge *
@@ -679,15 +699,6 @@ cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee,
       edge->uid = cgraph_edge_max_uid++;
     }
 
-  if (!callee->analyzed)
-    edge->inline_failed = CIF_BODY_NOT_AVAILABLE;
-  else if (callee->local.redefined_extern_inline)
-    edge->inline_failed = CIF_REDEFINED_EXTERN_INLINE;
-  else if (callee->local.inlinable)
-    edge->inline_failed = CIF_FUNCTION_NOT_CONSIDERED;
-  else
-    edge->inline_failed = CIF_FUNCTION_NOT_INLINABLE;
-
   edge->aux = NULL;
 
   edge->caller = caller;
@@ -721,6 +732,9 @@ cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee,
       gcc_assert (!*slot);
       *slot = edge;
     }
+
+  initialize_inline_failed (edge);
+
   return edge;
 }
 
index f9bc6201afbcec8ce30685444adabba56158ea50..3868712b3f7a819148e0106cef9206eba762269b 100644 (file)
@@ -78,30 +78,6 @@ record_reference (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
   return NULL_TREE;
 }
 
-/* Give initial reasons why inlining would fail on all calls from
-   NODE.  Those get either nullified or usually overwritten by more precise
-   reason later.  */
-
-static void
-initialize_inline_failed (struct cgraph_node *node)
-{
-  struct cgraph_edge *e;
-
-  for (e = node->callers; e; e = e->next_caller)
-    {
-      gcc_assert (!e->callee->global.inlined_to);
-      gcc_assert (e->inline_failed);
-      if (node->local.redefined_extern_inline)
-       e->inline_failed = CIF_REDEFINED_EXTERN_INLINE;
-      else if (!node->local.inlinable)
-       e->inline_failed = CIF_FUNCTION_NOT_INLINABLE;
-      else if (gimple_call_cannot_inline_p (e->call_stmt))
-       e->inline_failed = CIF_MISMATCHED_ARGUMENTS;
-      else
-       e->inline_failed = CIF_FUNCTION_NOT_CONSIDERED;
-    }
-}
-
 /* Computes the frequency of the call statement so that it can be stored in
    cgraph_edge.  BB is the basic block of the call statement.  */
 int
@@ -193,7 +169,6 @@ build_cgraph_edges (void)
     }
 
   pointer_set_destroy (visited_nodes);
-  initialize_inline_failed (node);
   return 0;
 }
 
@@ -253,8 +228,8 @@ rebuild_cgraph_edges (void)
                              bb->loop_depth);
 
       }
-  initialize_inline_failed (node);
   gcc_assert (!node->global.inlined_to);
+
   return 0;
 }
 
index ee2e36005dbd79ee23229cb3a515e6a3e0ead75f..b1d82e189c45ad60bbc93cc32f3b9e13b6cd6f1b 100644 (file)
@@ -1,3 +1,7 @@
+2009-03-28  Adam Nemet  <anemet@caviumnetworks.com>
+
+       * gcc.dg/winline-10.c: New test.
+
 2009-03-28  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/34656
diff --git a/gcc/testsuite/gcc.dg/winline-10.c b/gcc/testsuite/gcc.dg/winline-10.c
new file mode 100644 (file)
index 0000000..2106253
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Winline" } */
+
+struct s { int a; };
+
+inline void f (x)      /* { dg-warning "inlining .* mismatched arg" "" } */
+     int x;
+{
+  asm ("");
+}
+
+void g (struct s x)
+{
+  f (x);               /* { dg-warning "called from here" "" } */
+}
+
+void f (int x);                /* { dg-warning "follows non-prototype definition" } */
This page took 0.07766 seconds and 5 git commands to generate.