diff mbox

[lra] Cleanup the use of offmemok and don't count spilling cost for it

Message ID bf793462-3b67-0d29-052d-3db8e9169adf@foss.arm.com
State New
Headers show

Commit Message

Jiong Wang July 5, 2016, 4:09 p.m. UTC
On 04/07/16 20:44, Vladimir Makarov wrote:
> On 06/30/2016 01:22 PM, Jiong Wang wrote:
>>
>> Here is the patch,
>>  From my understanding, "offmemok" is used to represent a memory operand
>> who's address we want to reload, and searching of it's reference location
>> seems confirmed my understanding as it's always used together with MEM_P check.
>>
>> So this patch does the following modifications:
>>
>>    * Only set offmemok to true if MEM_P is also true, as otherwise offmemok
>>      is not used.
>>    * Remove redundant MEM_P check which was used together with offmemok.
>>    * Avoid the addition of spilling cost if offmemok be true as an address
>>      calculation reload is not spilling.
>>
>> bootstrap & gcc/g++ regression OK on x86_64/aarch64/arm.
>>
>> OK for trunk?
>
> Yes.  The patch looks OK to me.  Thank you for working on the 
> solution, Jiong.  As I wrote the code is very sensitive and any its 
> change might affect some targets.  Usually patches for this part of 
> LRA can take a few iterations.

Thanks for the review Vlad.

As Bernd has concerns on merging MEM_P into offmemok. I committed the
following patch as r238010 which keeps the functional change but without
merging checks.

2016-07-05  Jiong Wang<jiong.wang@arm.com>

gcc/
   * lra-constraints.c (process_alt_operands): Don't add spilling cost
   for "offmemok".
diff mbox

Patch

diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index bf08dce..e9d3e43 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -2488,7 +2488,9 @@  process_alt_operands (int only_alternative)
 
 		 Code below increases the reject for both pseudo and non-pseudo
 		 spill.  */
-	      if (no_regs_p && !(REG_P (op) && hard_regno[nop] < 0))
+	      if (no_regs_p
+		  && !(MEM_P (op) && offmemok)
+		  && !(REG_P (op) && hard_regno[nop] < 0))
 		{
 		  if (lra_dump_file != NULL)
 		    fprintf