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]

RFA: patch to fix PR39432


The following patch fixes PR 39432. The PR details can be found on

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39432

Compiler after the patch generates the same code for -On (n>=2).
It was checked on x86/x86_64 on about 20 benchmarks.

The patch was successfully bootstrapped on x86_64.

Ok to commit it to the trunk?

2009-03-11 Vladimir Makarov <vmakarov@redhat.com>

   PR debug/39432
   * ira-int.h (struct allocno): Fix comment for calls_crossed_num.
   * ira-conflicts.c (ira_build_conflicts): Prohibit call used
   registers for allocnos created from user-defined variables.

Index: gcc/ira-conflicts.c
===================================================================
--- gcc/ira-conflicts.c	(revision 144543)
+++ gcc/ira-conflicts.c	(working copy)
@@ -800,29 +800,33 @@
     }
   FOR_EACH_ALLOCNO (a, ai)
     {
-      if (ALLOCNO_CALLS_CROSSED_NUM (a) == 0)
-	continue;
-      if (! flag_caller_saves)
+      reg_attrs *attrs;
+      tree decl;
+
+      if ((! flag_caller_saves && ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
+	  /* For debugging purposes don't put user defined variables in
+	     callee-clobbered registers.  */
+	  || (optimize <= 1
+	      && (attrs = REG_ATTRS (regno_reg_rtx [ALLOCNO_REGNO (a)])) != NULL
+	      && (decl = attrs->decl) != NULL
+	      && VAR_OR_FUNCTION_DECL_P (decl)
+	      && ! DECL_ARTIFICIAL (decl)))
 	{
 	  IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a),
 			    call_used_reg_set);
-	  if (ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
-	    IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
-			      call_used_reg_set);
+	  IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
+			    call_used_reg_set);
 	}
-      else
+      else if (ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
 	{
 	  IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a),
 			    no_caller_save_reg_set);
 	  IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a),
 			    temp_hard_reg_set);
-	  if (ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
-	    {
-	      IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
-				no_caller_save_reg_set);
-	      IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
-				temp_hard_reg_set);
-	    }
+	  IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
+			    no_caller_save_reg_set);
+	  IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
+			    temp_hard_reg_set);
 	}
     }
   if (optimize && ira_conflicts_p
Index: gcc/ira-int.h
===================================================================
--- gcc/ira-int.h	(revision 144543)
+++ gcc/ira-int.h	(working copy)
@@ -333,7 +333,7 @@
   /* Accumulated frequency of calls which given allocno
      intersects.  */
   int call_freq;
-  /* Length of the previous array (number of the intersected calls).  */
+  /* Accumulated number of the intersected calls.  */
   int calls_crossed_num;
   /* Non NULL if we remove restoring value from given allocno to
      MEM_OPTIMIZED_DEST at loop exit (see ira-emit.c) because the

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