re PR debug/52001 (Huge compile-time regression with var-tracking)
authorJakub Jelinek <jakub@redhat.com>
Fri, 27 Jan 2012 09:26:48 +0000 (10:26 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 27 Jan 2012 09:26:48 +0000 (10:26 +0100)
PR debug/52001
* var-tracking.c (reverse_op): Don't add any reverse operation
if V already has any constant locations.

From-SVN: r183608

gcc/ChangeLog
gcc/var-tracking.c

index 0a4e08b..fe748f4 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/52001
+       * var-tracking.c (reverse_op): Don't add any reverse operation
+       if V already has any constant locations.
+
 2012-01-27  Sandra Loosemore  <sandra@codesourcery.com>
 
        * doc/invoke.texi: Correct usage of "command line" (noun)
index 557a2ca..1f4903a 100644 (file)
@@ -5298,6 +5298,7 @@ reverse_op (rtx val, const_rtx expr, rtx insn)
 {
   rtx src, arg, ret;
   cselib_val *v;
+  struct elt_loc_list *l;
   enum rtx_code code;
 
   if (GET_CODE (expr) != SET)
@@ -5333,6 +5334,14 @@ reverse_op (rtx val, const_rtx expr, rtx insn)
   if (!v || !cselib_preserved_value_p (v))
     return;
 
+  /* 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)
+    if (CONSTANT_P (l->loc)
+       && (GET_CODE (l->loc) != CONST || !references_value_p (l->loc, 0)))
+      return;
+
   switch (GET_CODE (src))
     {
     case NOT: