From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Cc: andrew.n.senkevich@gmail.com
Subject: [PATCH] Fix PR78306
Date: Tue, 15 Nov 2016 14:58:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.11.1611151556300.5294@t29.fhfr.qr> (raw)
Appearantly for some unknown reason we refuse to inline anything into
functions calling cilk_spawn. That breaks fortified headers and
all other always-inline function calls (intrinsics come to my mind as
well).
Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk?
Thanks,
Richard.
2016-11-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/78306
* ipa-inline-analysis.c (initialize_inline_failed): Do not
inhibit inlining if function calls cilk_spawn.
(can_inline_edge_p): Likewise.
* gcc.dg/cilk-plus/pr78306.c: New testcase.
Index: gcc/ipa-inline-analysis.c
===================================================================
--- gcc/ipa-inline-analysis.c (revision 242408)
+++ gcc/ipa-inline-analysis.c (working copy)
@@ -1507,9 +1507,6 @@ initialize_inline_failed (struct cgraph_
e->inline_failed = CIF_BODY_NOT_AVAILABLE;
else if (callee->local.redefined_extern_inline)
e->inline_failed = CIF_REDEFINED_EXTERN_INLINE;
- else if (cfun && fn_contains_cilk_spawn_p (cfun))
- /* We can't inline if the function is spawing a function. */
- e->inline_failed = CIF_CILK_SPAWN;
else
e->inline_failed = CIF_FUNCTION_NOT_CONSIDERED;
gcc_checking_assert (!e->call_stmt_cannot_inline_p
Index: gcc/ipa-inline.c
===================================================================
--- gcc/ipa-inline.c (revision 242408)
+++ gcc/ipa-inline.c (working copy)
@@ -368,11 +368,6 @@ can_inline_edge_p (struct cgraph_edge *e
e->inline_failed = CIF_FUNCTION_NOT_INLINABLE;
inlinable = false;
}
- else if (inline_summaries->get (caller)->contains_cilk_spawn)
- {
- e->inline_failed = CIF_CILK_SPAWN;
- inlinable = false;
- }
/* Don't inline a function with mismatched sanitization attributes. */
else if (!sanitize_attrs_match_for_inline_p (caller->decl, callee->decl))
{
Index: gcc/testsuite/gcc.dg/cilk-plus/pr78306.c
===================================================================
--- gcc/testsuite/gcc.dg/cilk-plus/pr78306.c (revision 0)
+++ gcc/testsuite/gcc.dg/cilk-plus/pr78306.c (working copy)
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fcilkplus" } */
+
+#define _FORTIFY_SOURCE=2
+#include <cilk/cilk.h>
+#include <string.h>
+#include <malloc.h>
+
+int sum(int low, int high)
+{
+ if(low == high) {
+ return low;
+ }
+
+ int mid = low + (high-low)/2;
+ int a = cilk_spawn sum(low, mid);
+ int b = sum(mid+1, high);
+
+ // Some very expensive computation here
+ int foo[64];
+ memset(foo, 0, 64*sizeof(int)); // <--- Fails
+
+ cilk_sync;
+
+ return a+b;
+}
+
+int main(void) {
+ return sum(0, 100);
+}
next reply other threads:[~2016-11-15 14:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-15 14:58 Richard Biener [this message]
2016-11-16 9:43 ` Richard Biener
2016-11-29 0:09 ` Jeff Law
2016-11-29 7:47 ` Richard Biener
2016-11-29 16:52 ` Jeff Law
2016-11-30 8:52 ` Richard Biener
2016-11-30 12:19 ` Andrew Senkevich
2016-11-30 14:18 ` Richard Biener
2016-12-02 21:35 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LSU.2.11.1611151556300.5294@t29.fhfr.qr \
--to=rguenther@suse.de \
--cc=andrew.n.senkevich@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).