diff options
author | Sriraman Tallam <tmsriram@google.com> | 2013-06-18 22:45:03 +0000 |
---|---|---|
committer | Sriraman Tallam <tmsriram@gcc.gnu.org> | 2013-06-18 22:45:03 +0000 |
commit | bef8491a658de9e8920acaeff6cb76ef4e946e2c (patch) | |
tree | 36b462d3fe220a71b684a5b371e52f55cfc14584 /gcc | |
parent | 3dd55b2f9fdbf102dad43fca46578f4054174d45 (diff) | |
download | gcc-bef8491a658de9e8920acaeff6cb76ef4e946e2c.zip gcc-bef8491a658de9e8920acaeff6cb76ef4e946e2c.tar.gz gcc-bef8491a658de9e8920acaeff6cb76ef4e946e2c.tar.bz2 |
Emit errors when always_inline functions cannot be inlined in -O0 mode.
* tree-inline.c (expand_call_inline): Allow the error to be flagged
in early inline pass.
* ipa-inline.c (inline_always_inline_functions): Pretend always_inline
functions are inlined during failures to flag an error.
* gcc.target/i386/inline_error.c: New test.
* gcc.c-torture/compile/pr44043.c: Fix test to expect an error.
* gcc.c-torture/compile/pr43791.c: Fix test to expect an error.
From-SVN: r200179
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ipa-inline.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr43791.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr44043.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/inline_error.c | 13 | ||||
-rw-r--r-- | gcc/tree-inline.c | 2 |
7 files changed, 38 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 20f42b1..d82677b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-06-18 Sriraman Tallam <tmsriram@google.com> + + * ipa-inline.c (inline_always_inline_functions): Pretend always_inline + functions are inlined during failures to flag an error. + * tree-inline.c (expand_call_inline): Allow the error to be flagged + in early inline pass. + 2013-06-18 H.J. Lu <hongjiu.lu@intel.com> * config/i386/i386.c (initial_ix86_tune_features): Fix a typo diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 5d50bb4..d1f0089 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -1911,7 +1911,15 @@ inline_always_inline_functions (struct cgraph_node *node) } if (!can_early_inline_edge_p (e)) - continue; + { + /* Set inlined to true if the callee is marked "always_inline" but + is not inlinable. This will allow flagging an error later in + expand_call_inline in tree-inline.c. */ + if (lookup_attribute ("always_inline", + DECL_ATTRIBUTES (callee->symbol.decl)) != NULL) + inlined = true; + continue; + } if (dump_file) fprintf (dump_file, " Inlining %s into %s (always_inline).\n", diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 53b844f..be51cb3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-06-18 Sriraman Tallam <tmsriram@google.com> + + * gcc.target/i386/inline_error.c: New test. + * gcc.c-torture/compile/pr44043.c: Fix test to expect an error. + * gcc.c-torture/compile/pr43791.c: Fix test to expect an error. + 2013-06-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53211 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43791.c b/gcc/testsuite/gcc.c-torture/compile/pr43791.c index 38cb3c8..0d8c94f 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr43791.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr43791.c @@ -19,3 +19,4 @@ void trylock(void) { fasttrylock(slowtrylock); } +/* { dg-prune-output "(inlining failed in call to always_inline.*indirect function call with a yet undetermined callee|called from here)" } */ diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44043.c b/gcc/testsuite/gcc.c-torture/compile/pr44043.c index 943501b..ea87678 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr44043.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr44043.c @@ -85,3 +85,5 @@ int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) { raw_send_hdrinc(sk, msg->msg_iov, len, (void *)0, msg->msg_flags); } + +/* { dg-prune-output "(inlining failed in call to always_inline.*indirect function call with a yet undetermined callee|called from here)" } */ diff --git a/gcc/testsuite/gcc.target/i386/inline_error.c b/gcc/testsuite/gcc.target/i386/inline_error.c new file mode 100644 index 0000000..da1cea1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/inline_error.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -mno-popcnt" } */ + +inline int __attribute__ ((__gnu_inline__, __always_inline__, target("popcnt"))) +foo () /* { dg-error "inlining failed in call to always_inline .* target specific option mismatch" } */ +{ + return 0; +} + +int bar() +{ + return foo (); /* { dg-error "called from here" } */ +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index bee7766..f524771 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3905,8 +3905,6 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id) for inlining, but we can't do that because frontends overwrite the body. */ && !cg_edge->callee->local.redefined_extern_inline - /* Avoid warnings during early inline pass. */ - && cgraph_global_info_ready /* PR 20090218-1_0.c. Body can be provided by another module. */ && (reason != CIF_BODY_NOT_AVAILABLE || !flag_generate_lto)) { |