This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Don't add useless reverse_op vta equivalences (PR debug/52001)


Hi!

When a VALUE contains already some constant location, it will be always
preferable to expressing it by some other expression - const (or some
similar reverse operation), so we just should point at adding the
reverse_op.

This fixes the testcase from the PR on mips64-linux, bootstrapped/regtested
on x86_64-linux and i686-linux, ok for trunk?

2012-01-26  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.

--- gcc/var-tracking.c.jj	2012-01-23 18:23:45.000000000 +0100
+++ gcc/var-tracking.c	2012-01-26 16:37:20.110049563 +0100
@@ -5298,6 +5298,7 @@ reverse_op (rtx val, const_rtx expr, rtx
 {
   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
   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:

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]