[23/32] Remove global call sets: postreload-gcse.c

Message ID mptr24mve4x.fsf@arm.com
State New
Headers show
Series
  • Support multiple ABIs in the same translation unit
Related show

Commit Message

Richard Sandiford Sept. 11, 2019, 7:14 p.m.
This is another case in which we should conservatively treat
partial kills as full kills.


2019-09-11  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* postreload-gcse.c: Include regs.h and function-abi.h.
	(record_opr_changes): Use call_insn_abi to get the ABI of the
	call insn target.  Conservatively assume that partially-clobbered
	registers are altered.

Comments

Richard Sandiford Sept. 25, 2019, 4:08 p.m. | #1
Richard Sandiford <richard.sandiford@arm.com> writes:
> This is another case in which we should conservatively treat

> partial kills as full kills.


Similary to the combine patch, I've updated this to avoid the
short "abi" name and use a temporary HARD_REG_SET instead.

Richard


2019-09-25  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* postreload-gcse.c: Include regs.h and function-abi.h.
	(record_opr_changes): Use insn_callee_abi to get the ABI of the
	call insn target.  Conservatively assume that partially-clobbered
	registers are altered.

Index: gcc/postreload-gcse.c
===================================================================
--- gcc/postreload-gcse.c	2019-09-12 10:52:50.000000000 +0100
+++ gcc/postreload-gcse.c	2019-09-25 17:06:55.213726369 +0100
@@ -41,6 +41,8 @@ Software Foundation; either version 3, o
 #include "intl.h"
 #include "gcse-common.h"
 #include "gcse.h"
+#include "regs.h"
+#include "function-abi.h"
 
 /* The following code implements gcse after reload, the purpose of this
    pass is to cleanup redundant loads generated by reload and other
@@ -772,7 +774,11 @@ record_opr_changes (rtx_insn *insn)
     {
       unsigned int regno;
       hard_reg_set_iterator hrsi;
-      EXECUTE_IF_SET_IN_HARD_REG_SET (regs_invalidated_by_call, 0, regno, hrsi)
+      /* We don't track modes of hard registers, so we need to be
+	 conservative and assume that partial kills are full kills.  */
+      HARD_REG_SET callee_clobbers
+	= insn_callee_abi (insn).full_and_partial_reg_clobbers ();
+      EXECUTE_IF_SET_IN_HARD_REG_SET (callee_clobbers, 0, regno, hrsi)
 	record_last_reg_set_info_regno (insn, regno);
 
       if (! RTL_CONST_OR_PURE_CALL_P (insn))
Jeff Law Sept. 29, 2019, 10:22 p.m. | #2
On 9/25/19 10:08 AM, Richard Sandiford wrote:
> Richard Sandiford <richard.sandiford@arm.com> writes:

>> This is another case in which we should conservatively treat

>> partial kills as full kills.

> 

> Similary to the combine patch, I've updated this to avoid the

> short "abi" name and use a temporary HARD_REG_SET instead.

> 

> Richard

> 

> 

> 2019-09-25  Richard Sandiford  <richard.sandiford@arm.com>

> 

> gcc/

> 	* postreload-gcse.c: Include regs.h and function-abi.h.

> 	(record_opr_changes): Use insn_callee_abi to get the ABI of the

> 	call insn target.  Conservatively assume that partially-clobbered

> 	registers are altered.

OK
jeff

Patch

Index: gcc/postreload-gcse.c
===================================================================
--- gcc/postreload-gcse.c	2019-09-09 18:58:51.472270712 +0100
+++ gcc/postreload-gcse.c	2019-09-11 19:48:45.585690715 +0100
@@ -41,6 +41,8 @@  Software Foundation; either version 3, o
 #include "intl.h"
 #include "gcse-common.h"
 #include "gcse.h"
+#include "regs.h"
+#include "function-abi.h"
 
 /* The following code implements gcse after reload, the purpose of this
    pass is to cleanup redundant loads generated by reload and other
@@ -770,9 +772,13 @@  record_opr_changes (rtx_insn *insn)
   /* Finally, if this is a call, record all call clobbers.  */
   if (CALL_P (insn))
     {
+      function_abi abi = call_insn_abi (insn);
       unsigned int regno;
       hard_reg_set_iterator hrsi;
-      EXECUTE_IF_SET_IN_HARD_REG_SET (regs_invalidated_by_call, 0, regno, hrsi)
+      /* We don't track modes of hard registers, so we need to be
+	 conservative and assume that partial kills are full kills.  */
+      EXECUTE_IF_SET_IN_HARD_REG_SET (abi.full_and_partial_reg_clobbers (),
+				      0, regno, hrsi)
 	record_last_reg_set_info_regno (insn, regno);
 
       if (! RTL_CONST_OR_PURE_CALL_P (insn))