From 22110e6c5710e3786e097cc0843f59a3376ee94f Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 4 Mar 2013 17:41:32 +0000 Subject: [PATCH] re PR tree-optimization/56424 (ICE at tree-inline.c:2833 on a-nllcef.ads at -O2) PR tree-optimization/56424 * ipa-split.c (split_function): Do not set the RSO flag if result is not by reference and its type is a register type. From-SVN: r196439 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-split.c | 4 +++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/pr56424.c | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr56424.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8a290e4a0de..175a619524b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-01-04 Eric Botcazou + + PR tree-optimization/56424 + * ipa-split.c (split_function): Do not set the RSO flag if result is + not by reference and its type is a register type. + 2013-03-04 David Holsgrove * config/microblaze/microblaze.c (microblaze_valid_pic_const): New diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index e3db78f5c05..e7d469d7442 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -1309,7 +1309,9 @@ split_function (struct split_point *split_point) so return slot optimization is always possible. Moreover this is required to make DECL_BY_REFERENCE work. */ if (aggregate_value_p (DECL_RESULT (current_function_decl), - TREE_TYPE (current_function_decl))) + TREE_TYPE (current_function_decl)) + && (!is_gimple_reg_type (TREE_TYPE (DECL_RESULT (current_function_decl))) + || DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))) gimple_call_set_return_slot_opt (call, true); /* Update return value. This is bit tricky. When we do not return, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index efe71e54c3f..19c64d61f64 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-01-04 Eric Botcazou + + * gcc.dg/pr56424.c: New test. + 2013-03-04 Georg-Johann Lay * gcc.dg/pr55153.c: Add dg-require-effective-target scheduling. diff --git a/gcc/testsuite/gcc.dg/pr56424.c b/gcc/testsuite/gcc.dg/pr56424.c new file mode 100644 index 00000000000..a724c640e99 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56424.c @@ -0,0 +1,33 @@ +/* PR tree-optimization/56424 */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fexceptions -fnon-call-exceptions" } */ + +extern long double cosl (long double); +extern long double sinl (long double); +extern long double reml (long double, long double); + +long double my_cos (long double arg) +{ + return cosl (arg); +} + +long double my_sin (long double arg) +{ + if (__builtin_fabs (arg) < 1.0) + return arg; + + return sinl (arg); +} + +long double my_cot (long double arg, long double cycle) +{ + long double t = reml (arg, cycle); + return my_cos (t) / my_sin (t); +} + +long double my_tan (long double arg, long double cycle) +{ + long double t = reml (arg, cycle); + return my_sin (t) / my_cos (t); +}