public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Add --param max-vartrack-reverse-op-size=N (PR debug/54402)
@ 2012-12-13  9:40 Jakub Jelinek
  2013-01-02 23:52 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2012-12-13  9:40 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-patches

Hi!

As the PR54402 go testcase shows, sometimes we end up with VALUEs with huge
(many thousands) long locs lists because we add too many reverse ops for the
same value.  Such huge locs lists of equivalences are hardly useful in
practice, reverse ops mainly help when there are just a few locs and most of
them don't have a register or memory location, and make e.g. find_base_term
or get_addr extremely expensive.

The following patch avoids adding further reverse op equivalences for VALUEs
if the locs list is already big enough, the default value of 50 makes the
go1 testcase significantly faster, but debug info/debug_loc size on x86_64-linux as
well as i686-linux was identical (for cc1plus/go1/libstdc++.so.6 I've
checked) between default of 50 and 1000, so I assume it didn't affect debug
info quality for those, and hope it is unlikely it will for other real-world
programs.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2012-12-12  Jakub Jelinek  <jakub@redhat.com>

	PR debug/54402
	* params.def (PARAM_MAX_VARTRACK_REVERSE_OP_SIZE): New param.
	* var-tracking.c (reverse_op): Don't add reverse ops to
	VALUEs that have already
	PARAM_VALUE (PARAM_MAX_VARTRACK_REVERSE_OP_SIZE) or longer
	locs list.

--- gcc/params.def.jj	2012-11-23 10:01:50.000000000 +0100
+++ gcc/params.def	2012-12-12 16:26:21.063473958 +0100
@@ -869,6 +869,14 @@ DEFPARAM (PARAM_MAX_VARTRACK_EXPR_DEPTH,
 	  "Max. recursion depth for expanding var tracking expressions",
 	  12, 0, 0)
 
+/* Set maximum length of value location list for which var tracking
+   should add reverse operations.  */
+
+DEFPARAM (PARAM_MAX_VARTRACK_REVERSE_OP_SIZE,
+	  "max-vartrack-reverse-op-size",
+	  "Max. size of loc list for which reverse ops should be added",
+	  50, 0, 0)
+
 /* Set minimum insn uid for non-debug insns.  */
 
 DEFPARAM (PARAM_MIN_NONDEBUG_INSN_UID,
--- gcc/var-tracking.c.jj	2012-12-12 15:57:29.000000000 +0100
+++ gcc/var-tracking.c	2012-12-12 16:28:27.089745791 +0100
@@ -5545,6 +5545,7 @@ reverse_op (rtx val, const_rtx expr, rtx
   cselib_val *v;
   struct elt_loc_list *l;
   enum rtx_code code;
+  int count;
 
   if (GET_CODE (expr) != SET)
     return;
@@ -5586,10 +5587,13 @@ reverse_op (rtx val, const_rtx expr, rtx
   /* Adding a reverse op isn't useful if V already has an always valid
      location.  Ignore ENTRY_VALUE, while it is always constant, we should
      prefer non-ENTRY_VALUE locations whenever possible.  */
-  for (l = v->locs; l; l = l->next)
+  for (l = v->locs, count = 0; l; l = l->next, count++)
     if (CONSTANT_P (l->loc)
 	&& (GET_CODE (l->loc) != CONST || !references_value_p (l->loc, 0)))
       return;
+    /* Avoid creating too large locs lists.  */
+    else if (count == PARAM_VALUE (PARAM_MAX_VARTRACK_REVERSE_OP_SIZE))
+      return;
 
   switch (GET_CODE (src))
     {

	Jakub

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

* Re: [PATCH] Add --param max-vartrack-reverse-op-size=N (PR debug/54402)
  2012-12-13  9:40 [PATCH] Add --param max-vartrack-reverse-op-size=N (PR debug/54402) Jakub Jelinek
@ 2013-01-02 23:52 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2013-01-02 23:52 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Alexandre Oliva, gcc-patches

On 12/13/2012 01:39 AM, Jakub Jelinek wrote:
> 	PR debug/54402
> 	* params.def (PARAM_MAX_VARTRACK_REVERSE_OP_SIZE): New param.
> 	* var-tracking.c (reverse_op): Don't add reverse ops to
> 	VALUEs that have already
> 	PARAM_VALUE (PARAM_MAX_VARTRACK_REVERSE_OP_SIZE) or longer
> 	locs list.

Ok.


r~

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

end of thread, other threads:[~2013-01-02 23:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-13  9:40 [PATCH] Add --param max-vartrack-reverse-op-size=N (PR debug/54402) Jakub Jelinek
2013-01-02 23:52 ` Richard Henderson

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