diff mbox

patch to fix PR49990

Message ID 4E406F1F.8030508@redhat.com
State New
Headers show

Commit Message

Vladimir Makarov Aug. 8, 2011, 11:19 p.m. UTC
The following patch fixes PR49990.  The problem is described on

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

Reg classes which can not change modes for some pseudo were excluded 
from the consideration.  As I wrote recently, they should not.  Instead 
the correct cost for changing mode (by moving through memory or other 
class register) should be taken into the account.  I believe the cost is 
already calculated rightly for this case, fortunately.

The patch was successfully bootstrapped on x86-64 and ppc64.  Actually I 
did not find a difference in generated code on variety tests on 
x86/x86-64 and arm (that is what I tried).

Committed as rev. 177575.



2011-08-08  Vladimir Makarov <vmakarov@redhat.com>

         PR rtl-optimization/49990
         * ira-costs.c (print_allocno_costs, print_pseudo_costs): Don't
         ignore classes which can not change mode.
         (find_costs_and_classes): Ditto.

Comments

H.J. Lu Aug. 9, 2011, 2:35 a.m. UTC | #1
On Mon, Aug 8, 2011 at 4:19 PM, Vladimir Makarov <vmakarov@redhat.com> wrote:
> The following patch fixes PR49990.  The problem is described on
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49936
>
> Reg classes which can not change modes for some pseudo were excluded from
> the consideration.  As I wrote recently, they should not.  Instead the
> correct cost for changing mode (by moving through memory or other class
> register) should be taken into the account.  I believe the cost is already
> calculated rightly for this case, fortunately.
>
> The patch was successfully bootstrapped on x86-64 and ppc64.  Actually I did
> not find a difference in generated code on variety tests on x86/x86-64 and
> arm (that is what I tried).
>
> Committed as rev. 177575.
>
>
>
> 2011-08-08  Vladimir Makarov <vmakarov@redhat.com>
>
>        PR rtl-optimization/49990
>        * ira-costs.c (print_allocno_costs, print_pseudo_costs): Don't
>        ignore classes which can not change mode.
>        (find_costs_and_classes): Ditto.
>
>

It breaks GCC on Linux/x86:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50026
Vladimir Makarov Aug. 9, 2011, 2:37 p.m. UTC | #2
On 08/08/2011 10:35 PM, H.J. Lu wrote:
> On Mon, Aug 8, 2011 at 4:19 PM, Vladimir Makarov<vmakarov@redhat.com>  wrote:
>> The following patch fixes PR49990.  The problem is described on
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49936
>>
>> Reg classes which can not change modes for some pseudo were excluded from
>> the consideration.  As I wrote recently, they should not.  Instead the
>> correct cost for changing mode (by moving through memory or other class
>> register) should be taken into the account.  I believe the cost is already
>> calculated rightly for this case, fortunately.
>>
>> The patch was successfully bootstrapped on x86-64 and ppc64.  Actually I did
>> not find a difference in generated code on variety tests on x86/x86-64 and
>> arm (that is what I tried).
>>
>> Committed as rev. 177575.
>>
>>
>>
>> 2011-08-08  Vladimir Makarov<vmakarov@redhat.com>
>>
>>         PR rtl-optimization/49990
>>         * ira-costs.c (print_allocno_costs, print_pseudo_costs): Don't
>>         ignore classes which can not change mode.
>>         (find_costs_and_classes): Ditto.
>>
>>
> It breaks GCC on Linux/x86:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50026
>
>
Thanks for reporting.

I reverted the patch although I can not still reproduce it on my machine.
H.J. Lu Aug. 9, 2011, 2:50 p.m. UTC | #3
On Tue, Aug 9, 2011 at 7:37 AM, Vladimir Makarov <vmakarov@redhat.com> wrote:
> On 08/08/2011 10:35 PM, H.J. Lu wrote:
>>
>> On Mon, Aug 8, 2011 at 4:19 PM, Vladimir Makarov<vmakarov@redhat.com>
>>  wrote:
>>>
>>> The following patch fixes PR49990.  The problem is described on
>>>
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49936
>>>
>>> Reg classes which can not change modes for some pseudo were excluded from
>>> the consideration.  As I wrote recently, they should not.  Instead the
>>> correct cost for changing mode (by moving through memory or other class
>>> register) should be taken into the account.  I believe the cost is
>>> already
>>> calculated rightly for this case, fortunately.
>>>
>>> The patch was successfully bootstrapped on x86-64 and ppc64.  Actually I
>>> did
>>> not find a difference in generated code on variety tests on x86/x86-64
>>> and
>>> arm (that is what I tried).
>>>
>>> Committed as rev. 177575.
>>>
>>>
>>>
>>> 2011-08-08  Vladimir Makarov<vmakarov@redhat.com>
>>>
>>>        PR rtl-optimization/49990
>>>        * ira-costs.c (print_allocno_costs, print_pseudo_costs): Don't
>>>        ignore classes which can not change mode.
>>>        (find_costs_and_classes): Ditto.
>>>
>>>
>> It breaks GCC on Linux/x86:
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50026
>>
>>
> Thanks for reporting.
>
> I reverted the patch although I can not still reproduce it on my machine.
>

My configurations are

--enable-clocale=gnu --with-system-zlib --enable-shared
--with-demangler-in-ld --enable-cloog-backend=isl
--with-ppl-include=/opt/gnu/include --with-ppl-lib=/opt/gnu/lib64
--with-cloog-include=/opt/gnu/include --with-cloog-lib=/opt/gnu/lib64
--with-fpmath=sse --enable-languages=c,c++,fortran,java,lto,objc

and

--with-arch=corei7 --with-cpu=corei7 --enable-clocale=gnu
--with-system-zlib --enable-shared --with-demangler-in-ld
--enable-cloog-backend=isl --with-ppl-include=/opt/gnu/include
--with-ppl-lib=/opt/gnu/lib64 --with-cloog-include=/opt/gnu/include
--with-cloog-lib=/opt/gnu/lib64 --with-fpmath=sse
--enable-languages=c,c++,fortran,java,lto,objc

on Fedora 15/Intel Core i7.

Thanks.
Vladimir Makarov Aug. 9, 2011, 4:16 p.m. UTC | #4
On 08/09/2011 10:50 AM, H.J. Lu wrote:
> On Tue, Aug 9, 2011 at 7:37 AM, Vladimir Makarov<vmakarov@redhat.com>  wrote:
>> On 08/08/2011 10:35 PM, H.J. Lu wrote:
>>> On Mon, Aug 8, 2011 at 4:19 PM, Vladimir Makarov<vmakarov@redhat.com>
>>>   wrote:
>>>> The following patch fixes PR49990.  The problem is described on
>>>>
>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49936
>>>>
>>>> Reg classes which can not change modes for some pseudo were excluded from
>>>> the consideration.  As I wrote recently, they should not.  Instead the
>>>> correct cost for changing mode (by moving through memory or other class
>>>> register) should be taken into the account.  I believe the cost is
>>>> already
>>>> calculated rightly for this case, fortunately.
>>>>
>>>> The patch was successfully bootstrapped on x86-64 and ppc64.  Actually I
>>>> did
>>>> not find a difference in generated code on variety tests on x86/x86-64
>>>> and
>>>> arm (that is what I tried).
>>>>
>>>> Committed as rev. 177575.
>>>>
>>>>
>>>>
>>>> 2011-08-08  Vladimir Makarov<vmakarov@redhat.com>
>>>>
>>>>         PR rtl-optimization/49990
>>>>         * ira-costs.c (print_allocno_costs, print_pseudo_costs): Don't
>>>>         ignore classes which can not change mode.
>>>>         (find_costs_and_classes): Ditto.
>>>>
>>>>
>>> It breaks GCC on Linux/x86:
>>>
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50026
>>>
>>>
>> Thanks for reporting.
>>
>> I reverted the patch although I can not still reproduce it on my machine.
>>
> My configurations are
>
> --enable-clocale=gnu --with-system-zlib --enable-shared
> --with-demangler-in-ld --enable-cloog-backend=isl
> --with-ppl-include=/opt/gnu/include --with-ppl-lib=/opt/gnu/lib64
> --with-cloog-include=/opt/gnu/include --with-cloog-lib=/opt/gnu/lib64
> --with-fpmath=sse --enable-languages=c,c++,fortran,java,lto,objc
>
> and
>
> --with-arch=corei7 --with-cpu=corei7 --enable-clocale=gnu
> --with-system-zlib --enable-shared --with-demangler-in-ld
> --enable-cloog-backend=isl --with-ppl-include=/opt/gnu/include
> --with-ppl-lib=/opt/gnu/lib64 --with-cloog-include=/opt/gnu/include
> --with-cloog-lib=/opt/gnu/lib64 --with-fpmath=sse
> --enable-languages=c,c++,fortran,java,lto,objc
Thanks, HJ.  I reproduced it now.
diff mbox

Patch

Index: ira-costs.c
===================================================================
--- ira-costs.c	(revision 177573)
+++ ira-costs.c	(working copy)
@@ -1367,11 +1367,7 @@  print_allocno_costs (FILE *f)
       for (k = 0; k < cost_classes_ptr->num; k++)
 	{
 	  rclass = cost_classes[k];
-	  if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)]
-#ifdef CANNOT_CHANGE_MODE_CLASS
-	      && ! invalid_mode_change_p (regno, (enum reg_class) rclass)
-#endif
-	      )
+	  if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)])
 	    {
 	      fprintf (f, " %s:%d", reg_class_names[rclass],
 		       COSTS (costs, i)->cost[k]);
@@ -1409,11 +1405,7 @@  print_pseudo_costs (FILE *f)
       for (k = 0; k < cost_classes_ptr->num; k++)
 	{
 	  rclass = cost_classes[k];
-	  if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)]
-#ifdef CANNOT_CHANGE_MODE_CLASS
-	      && ! invalid_mode_change_p (regno, (enum reg_class) rclass)
-#endif
-	      )
+	  if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)])
 	    fprintf (f, " %s:%d", reg_class_names[rclass],
 		     COSTS (costs, regno)->cost[k]);
 	}
@@ -1650,11 +1642,7 @@  find_costs_and_classes (FILE *dump_file)
 	      rclass = cost_classes[k];
 	      /* Ignore classes that are too small or invalid for this
 		 operand.  */
-	      if (! contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (i)]
-#ifdef CANNOT_CHANGE_MODE_CLASS
-		  || invalid_mode_change_p (i, (enum reg_class) rclass)
-#endif
-		  )
+	      if (! contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (i)])
 		continue;
 	      if (i_costs[k] < best_cost)
 		{
@@ -1725,11 +1713,7 @@  find_costs_and_classes (FILE *dump_file)
 			continue;
 		      /* Ignore classes that are too small or invalid
 			 for this operand.  */
-		      if (! contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (i)]
-#ifdef CANNOT_CHANGE_MODE_CLASS
-			  || invalid_mode_change_p (i, (enum reg_class) rclass)
-#endif
-			  )
+		      if (! contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (i)])
 			;
 		      else if (total_a_costs[k] < best_cost)
 			{