diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-08 15:16:22 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-08 15:16:22 +0000 |
commit | a1942f0c9db4c65c6b61950cbda4d92e449a972b (patch) | |
tree | c00e0356ac03d362aa0c47b542073da126813776 | |
parent | 6aa221fad7d894d4fd57bded6faf942a4c6cdd79 (diff) | |
download | gcc-a1942f0c9db4c65c6b61950cbda4d92e449a972b.tar.gz |
2011-11-08 Richard Guenther <rguenther@suse.de>
PR tree-optimization/51012
* ipa-prop.c (update_indirect_edges_after_inlining): Fixup
non-inlinable state.
* cgraph.c (cgraph_make_edge_direct): Likewise.
* gcc.dg/pr51012-1.c: New testcase.
* gcc.dg/pr51012-2.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181166 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cgraph.c | 7 | ||||
-rw-r--r-- | gcc/ipa-prop.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr51012-1.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr51012-2.c | 17 |
6 files changed, 61 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e5050e1248b..7db3a37a442 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-11-08 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/51012 + * ipa-prop.c (update_indirect_edges_after_inlining): Fixup + non-inlinable state. + * cgraph.c (cgraph_make_edge_direct): Likewise. + 2011-11-08 Eric Botcazou <ebotcazou@adacore.com> PR rtl-optimization/47698 diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 2d226d49939..44a950ca743 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1184,6 +1184,13 @@ cgraph_make_edge_direct (struct cgraph_edge *edge, struct cgraph_node *callee) /* Insert to callers list of the new callee. */ cgraph_set_edge_callee (edge, callee); + if (edge->call_stmt + && !gimple_check_call_matching_types (edge->call_stmt, callee->decl)) + { + gimple_call_set_cannot_inline (edge->call_stmt, true); + edge->call_stmt_cannot_inline_p = true; + } + /* We need to re-determine the inlining status of the edge. */ initialize_inline_failed (edge); } diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 7946aca0bff..69f0453ee4f 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1905,6 +1905,13 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, if (new_direct_edge) { new_direct_edge->indirect_inlining_edge = 1; + if (new_direct_edge->call_stmt + && !gimple_check_call_matching_types (new_direct_edge->call_stmt, + new_direct_edge->callee->decl)) + { + gimple_call_set_cannot_inline (new_direct_edge->call_stmt, true); + new_direct_edge->call_stmt_cannot_inline_p = true; + } if (new_edges) { VEC_safe_push (cgraph_edge_p, heap, *new_edges, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6fb865c44b3..1a7528a74e2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2011-11-08 Richard Guenther <rguenther@suse.de> + PR tree-optimization/51012 + * gcc.dg/pr51012-1.c: New testcase. + * gcc.dg/pr51012-2.c: Likewise. + +2011-11-08 Richard Guenther <rguenther@suse.de> + PR middle-end/51010 * c-c++-common/uninit-pr51010.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/pr51012-1.c b/gcc/testsuite/gcc.dg/pr51012-1.c new file mode 100644 index 00000000000..36c788bd526 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr51012-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-early-inlining -fno-ipa-cp" } */ + +float baz (void) +{ + return 0; +} + +static inline int bar (int (*ibaz) (void)) +{ + return ibaz (); +} + +void foo (void) +{ + bar((int (*)(void))baz); +} diff --git a/gcc/testsuite/gcc.dg/pr51012-2.c b/gcc/testsuite/gcc.dg/pr51012-2.c new file mode 100644 index 00000000000..fcc8cea7b3a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr51012-2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-early-inlining" } */ + +float baz (void) +{ + return 0; +} + +static inline int bar (int (*ibaz) (void)) +{ + return ibaz (); +} + +void foo (void) +{ + bar((int (*)(void))baz); +} |