From dcf89d578058ed538e3dcf4e151d99a267e81bf4 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Mon, 11 Jan 2016 11:09:17 +0100 Subject: [PR ipa/69044] Do not clone for param removal when not possible 2016-01-11 Martin Jambor PR ipa/69044 * ipa-cp.c (estimate_local_effects): Do not clone for removal of useless parameters if we cannot change function signature. testsuite/ * gcc.target/i386/chkp-pr69044.c: New test. From-SVN: r232215 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-cp.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/chkp-pr69044.c | 11 +++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/chkp-pr69044.c (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d78db3b..f28cf44 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2016-01-11 Martin Jambor + PR ipa/69044 + * ipa-cp.c (estimate_local_effects): Do not clone for removal of + useless parameters if we cannot change function signature. + +2016-01-11 Martin Jambor + PR ipa/66616 * cgraphclones.c (duplicate_thunk_for_node): Copy can_change_signature flag. diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index e17cc57..5900d4d 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -2518,7 +2518,8 @@ estimate_local_effects (struct cgraph_node *node) known_aggs_ptrs = agg_jmp_p_vec_for_t_vec (known_aggs); int devirt_bonus = devirtualization_time_bonus (node, known_csts, known_contexts, known_aggs_ptrs); - if (always_const || devirt_bonus || removable_params_cost) + if (always_const || devirt_bonus + || (removable_params_cost && node->local.can_change_signature)) { struct caller_statistics stats; inline_hints hints; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a160ed0..69f589f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-01-11 Martin Jambor + + PR ipa/69044 + * gcc.target/i386/chkp-pr69044.c: New test. + 2016-01-11 Tom de Vries PR tree-optimization/69109 diff --git a/gcc/testsuite/gcc.target/i386/chkp-pr69044.c b/gcc/testsuite/gcc.target/i386/chkp-pr69044.c new file mode 100644 index 0000000..933e88a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/chkp-pr69044.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mpx } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -O2" } */ + +int i; +int strncasecmp (char *p1, char *p2, long p3) { return 0; } +int special_command () +{ + if (strncasecmp (0, 0, 0)) + i++; +} -- cgit v1.1