diff options
author | Richard Biener <rguenther@suse.de> | 2016-11-17 08:42:50 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-11-17 08:42:50 +0000 |
commit | 8ce3fee51b0ede9b6033cd45d4ce6df56b5ec71a (patch) | |
tree | ef9be086f36804e6714d6b5fc529319cb8339370 /gcc | |
parent | f8294131788cec4ca520032073e92928fbbb06a2 (diff) | |
download | gcc-8ce3fee51b0ede9b6033cd45d4ce6df56b5ec71a.zip gcc-8ce3fee51b0ede9b6033cd45d4ce6df56b5ec71a.tar.gz gcc-8ce3fee51b0ede9b6033cd45d4ce6df56b5ec71a.tar.bz2 |
re PR middle-end/78306 ([CilkPlus] "inlining failed in call to always_inline ‘memset’: function not inlinable" with -fcilkplus)
2016-11-17 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.
From-SVN: r242537
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ipa-inline-analysis.c | 3 | ||||
-rw-r--r-- | gcc/ipa-inline.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cilk-plus/pr78306.c | 30 |
5 files changed, 42 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8e527a..d70f88d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2016-11-17 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. + +2016-11-17 Richard Biener <rguenther@suse.de> + PR middle-end/78305 * fold-const.c (negate_expr_p): Fix multiplication case. diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 8228e8a..1b5f805 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -1507,9 +1507,6 @@ initialize_inline_failed (struct cgraph_edge *e) 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 diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 82bb94f..5f2371c 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -368,11 +368,6 @@ can_inline_edge_p (struct cgraph_edge *e, bool report, 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)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c142b4b..9545d9c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2016-11-17 Richard Biener <rguenther@suse.de> + PR tree-optimization/78306 + * gcc.dg/cilk-plus/pr78306.c: New testcase. + +2016-11-17 Richard Biener <rguenther@suse.de> + PR middle-end/78305 * gcc.dg/torture/pr78305.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/cilk-plus/pr78306.c b/gcc/testsuite/gcc.dg/cilk-plus/pr78306.c new file mode 100644 index 0000000..4604271 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cilk-plus/pr78306.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fcilkplus" } */ + +#define _FORTIFY_SOURCE 2 +#include <string.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) { + if (sum(0, 100) != 5050) + __builtin_abort (); + return 0; +} |