public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PR 69044] Do not clone for parameter removal when !can_change_signature
@ 2016-01-08 18:01 Martin Jambor
  2016-01-09  0:09 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Jambor @ 2016-01-08 18:01 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka

Hi,

we generally do not have ther ability to propagate constants to and
clone CHKP instrumented functions.  Therefore we do not propagate
stuff into their lattices but since Honza changed cloning for all
contexts heuristics a few weeks ago, we might attempt to clone them
for unused parameter removal, which then leads to an ICE (and all
sorts of issues).

The heuristics however should not attempt to do that because the
function cgraph_node has can_change_signature flag cleared.  So this
patch changes it accordingly.  Bootstrapped and tested on
x86_64-linux, OK for trunk?

Thanks,

Martin


2016-01-08  Martin Jambor  <mjambor@suse.cz>

	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.

diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 782df71..d99e69c 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/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++;
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PR 69044] Do not clone for parameter removal when !can_change_signature
  2016-01-08 18:01 [PR 69044] Do not clone for parameter removal when !can_change_signature Martin Jambor
@ 2016-01-09  0:09 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2016-01-09  0:09 UTC (permalink / raw)
  To: GCC Patches, Jan Hubicka

On 01/08/2016 11:01 AM, Martin Jambor wrote:
> Hi,
>
> we generally do not have ther ability to propagate constants to and
> clone CHKP instrumented functions.  Therefore we do not propagate
> stuff into their lattices but since Honza changed cloning for all
> contexts heuristics a few weeks ago, we might attempt to clone them
> for unused parameter removal, which then leads to an ICE (and all
> sorts of issues).
>
> The heuristics however should not attempt to do that because the
> function cgraph_node has can_change_signature flag cleared.  So this
> patch changes it accordingly.  Bootstrapped and tested on
> x86_64-linux, OK for trunk?
>
> Thanks,
>
> Martin
>
>
> 2016-01-08  Martin Jambor  <mjambor@suse.cz>
>
> 	PR ipa/69044
> 	* ipa-cp.c (estimate_local_effects): Do not clone for removal of
> 	useless parameters if we cannot change function signature.
OK.
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-09  0:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-08 18:01 [PR 69044] Do not clone for parameter removal when !can_change_signature Martin Jambor
2016-01-09  0:09 ` Jeff Law

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).