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]

Re: [PATCH] Test arm_tune_xscale, not arm_arch_xscale


Roger Sayle <roger@eyesopen.com> writes:

> On 14 Dec 2004, Ian Lance Taylor wrote:
> > +  if (undobuf.other_insn)
> > +    {
> > +      int old_other_cost, new_other_cost;
> > +
> > +      old_other_cost = (INSN_UID (undobuf.other_insn) <= last_insn_cost
> > +			? uid_insn_cost[INSN_UID (undobuf.other_insn)] : 0);
> > +      new_other_cost = insn_rtx_cost (PATTERN (undobuf.other_insn));
> > +      if (old_other_cost > 0 && new_other_cost > 0)
> > +	{
> > +	  old_cost += old_other_cost;
> > +	  new_cost += new_other_cost;
> > +	}
> > +    }
> > +
> 
> It's admittedly a border line case, but could you bootstrap and regression
> test a minor tweak to the final clause above?
> 
> 	if (old_other_cost > 0 && new_other_cost > 0)
> 	  {
> 	    old_cost += old_other_cost;
> 	    new_cost += new_other_cost;
> 	  }
> +	else
> +	  old_cost = 0;
> 
> This should have the effect of preserving the current behaviour if
> the instruction cost of the undobuf.other_insn can't be determined;
> i.e. if the cost of the other_insn can't be calculated before or
> after this combination attempt, allow the recombination to go ahead.

This patch has been bootstrapped and regression tested on
i686-pc-linux-gnu with no noticeable affect.  OK for mainline?  If so,
I'll commit it and submit another copy of the ARM backend changes for
approval.  Thanks.

Ian


2004-12-14  Ian Lance Taylor  <ian@wasabisystems.com>

	* combine.c (combine_validate_cost): Consider cost of
	undobuf.other_insn rather than always allowing the recombination
	if it is set.


Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.462
diff -p -u -r1.462 combine.c
--- combine.c	27 Nov 2004 09:38:55 -0000	1.462
+++ combine.c	15 Dec 2004 00:17:37 -0000
@@ -560,10 +560,25 @@ combine_validate_cost (rtx i1, rtx i2, r
       new_i2_cost = 0;
     }
 
+  if (undobuf.other_insn)
+    {
+      int old_other_cost, new_other_cost;
+
+      old_other_cost = (INSN_UID (undobuf.other_insn) <= last_insn_cost
+			? uid_insn_cost[INSN_UID (undobuf.other_insn)] : 0);
+      new_other_cost = insn_rtx_cost (PATTERN (undobuf.other_insn));
+      if (old_other_cost > 0 && new_other_cost > 0)
+	{
+	  old_cost += old_other_cost;
+	  new_cost += new_other_cost;
+	}
+      else
+	old_cost = 0;
+    }
+
   /* Disallow this recombination if both new_cost and old_cost are
      greater than zero, and new_cost is greater than old cost.  */
-  if (!undobuf.other_insn
-      && old_cost > 0
+  if (old_cost > 0
       && new_cost > old_cost)
     {
       if (dump_file)


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