PR debug/54402
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Jan 2013 08:52:10 +0000 (08:52 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Jan 2013 08:52:10 +0000 (08:52 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194834 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/params.def
gcc/var-tracking.c

index b1dda60..0c89cc4 100644 (file)
@@ -1,3 +1,12 @@
+2013-01-03  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.
+
 2013-01-02  Gerald Pfeifer  <gerald@pfeifer.com>
 
        * doc/contrib.texi: Note years as release manager for Mark Mitchell.
index 38aaf4b..a307b71 100644 (file)
@@ -1,6 +1,6 @@
 /* params.def - Run-time parameters.
    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-   2011, 2012
+   2011, 2012, 2013
    Free Software Foundation, Inc.
    Written by Mark Mitchell <mark@codesourcery.com>.
 
@@ -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,
index f5ba115..9f1a507 100644 (file)
@@ -1,6 +1,6 @@
 /* Variable tracking routines for the GNU compiler.
-   Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012,
+   2013 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -5545,6 +5545,7 @@ reverse_op (rtx val, const_rtx expr, rtx insn)
   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 insn)
   /* 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))
     {