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: [RFB] IRA and regclass both ignore '!' attribute


On Fri, Oct 31, 2008 at 3:09 AM, Andrew Pinski
<Andrew_Pinski@playstation.sony.com> wrote:
> I noticed while looking into a register allocation issue in 4.1.1,
> that regclass was ignoring '!' attribute so it would sometimes give
> the wrong result so we get performance issue (selecting GPR instead of
> FPR).  So I saw that IRA also ignore it too which seems wrong and
> seems like the code was copied from regclass.  preprocess_constraints
> and find_reloads both take '!' into account.
>
> Can someone benchmark this on x86 and PPC? I can only really benchmark
> with a 4.3 or 4.1.1 based compiler with a subset of SPEC.  The 4.1.1
> based compiler gets a nice but small 0.6% performance increase and a
> small code decrease.

Huh, they are all subtly differen though ;)

preprocess_constraints does

                case '?':
                  op_alt[j].reject += 6;
                  break;
                case '!':
                  op_alt[j].reject += 600;
                  break;

while find_reloads is

              case '?':
                reject += 6;
                break;

              case '!':
                reject = 600;
                break;

and your patch introduces

@@ -1682,10 +1682,14 @@ record_reg_classes (int n_alts, int n_op
 		  /* Ignore the next letter for this pass.  */
 		  c = *++p;
 		  break;
+
+               case '!':
+                 alt_cost += 200;
+                 break;

 		case '?':
 		  alt_cost += 2;

and

@@ -358,9 +358,13 @@ record_reg_classes (int n_alts, int n_op
 		  c = *++p;
 		  break;

+		case '!':
+		  alt_cost += 2;
+		  break;
+
 		case '?':
 		  alt_cost += 2;

I especially wonder about the record_reg_classes += 2 which I would have
estimated to be alt_cost += 200 (or alt_cost = 200 if matching find_reloads).

Funny.

But in general fixing up record_reg_classes looks like the correct thing to do.

Any idea why we have += vs = and why we use different bases
appearantly (2 vs. 6)?

Thanks,
Richard.

> Thanks,
> Andrew Pinski
>
> ChangeLog:
> * regclass.c (record_reg_classes): Take into account '!'.
> (record_reg_classes): Likewise.
>


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