diff mbox series

Remove PHI_RESULT_PTR and change some PHI_RESULT to be gimple_phi_result [PR116643]

Message ID 20240920040128.3286537-1-quic_apinski@quicinc.com
State New
Headers show
Series Remove PHI_RESULT_PTR and change some PHI_RESULT to be gimple_phi_result [PR116643] | expand

Commit Message

Andrew Pinski Sept. 20, 2024, 4:01 a.m. UTC
There was only a few uses PHI_RESULT_PTR so lets remove it and use gimple_phi_result_ptr
or gimple_phi_result directly instead.
Since I was modifying ssa-iterators.h for the use of PHI_RESULT_PTR, change the use
of PHI_RESULT there to be gimple_phi_result instead.

This also removes one extra indirection that was done for PHI_RESULT so stage2 building
should be slightly faster.

Bootstrapped and tested on x86_64-linux-gnu.

	PR middle-end/116643

gcc/ChangeLog:

	* ssa-iterators.h (single_phi_def): Use gimple_phi_result
	instead of PHI_RESULT.
	(op_iter_init_phidef): Use gimple_phi_result/gimple_phi_result_ptr
	instead of PHI_RESULT/PHI_RESULT_PTR.
	* tree-ssa-operands.h (PHI_RESULT_PTR): Remove.
	(PHI_RESULT): Use gimple_phi_result directly.
	(SET_PHI_RESULT): Use gimple_phi_result_ptr directly.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
 gcc/ssa-iterators.h     | 6 +++---
 gcc/tree-ssa-operands.h | 5 ++---
 2 files changed, 5 insertions(+), 6 deletions(-)

Comments

Richard Biener Sept. 20, 2024, 4:51 a.m. UTC | #1
> Am 20.09.2024 um 06:02 schrieb Andrew Pinski <quic_apinski@quicinc.com>:
> 
> There was only a few uses PHI_RESULT_PTR so lets remove it and use gimple_phi_result_ptr
> or gimple_phi_result directly instead.
> Since I was modifying ssa-iterators.h for the use of PHI_RESULT_PTR, change the use
> of PHI_RESULT there to be gimple_phi_result instead.
> 
> This also removes one extra indirection that was done for PHI_RESULT so stage2 building
> should be slightly faster.
> 
> Bootstrapped and tested on x86_64-linux-gnu.

Ok

Richard 

>    PR middle-end/116643
> 
> gcc/ChangeLog:
> 
>    * ssa-iterators.h (single_phi_def): Use gimple_phi_result
>    instead of PHI_RESULT.
>    (op_iter_init_phidef): Use gimple_phi_result/gimple_phi_result_ptr
>    instead of PHI_RESULT/PHI_RESULT_PTR.
>    * tree-ssa-operands.h (PHI_RESULT_PTR): Remove.
>    (PHI_RESULT): Use gimple_phi_result directly.
>    (SET_PHI_RESULT): Use gimple_phi_result_ptr directly.
> 
> Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> ---
> gcc/ssa-iterators.h     | 6 +++---
> gcc/tree-ssa-operands.h | 5 ++---
> 2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/gcc/ssa-iterators.h b/gcc/ssa-iterators.h
> index b7b01fd018a..e0e555cc472 100644
> --- a/gcc/ssa-iterators.h
> +++ b/gcc/ssa-iterators.h
> @@ -768,7 +768,7 @@ num_ssa_operands (gimple *stmt, int flags)
> inline tree
> single_phi_def (gphi *stmt, int flags)
> {
> -  tree def = PHI_RESULT (stmt);
> +  tree def = gimple_phi_result (stmt);
>   if ((flags & SSA_OP_DEF) && is_gimple_reg (def))
>     return def;
>   if ((flags & SSA_OP_VIRTUAL_DEFS) && !is_gimple_reg (def))
> @@ -811,7 +811,7 @@ op_iter_init_phiuse (ssa_op_iter *ptr, gphi *phi, int flags)
> inline def_operand_p
> op_iter_init_phidef (ssa_op_iter *ptr, gphi *phi, int flags)
> {
> -  tree phi_def = PHI_RESULT (phi);
> +  tree phi_def = gimple_phi_result (phi);
>   int comp;
> 
>   clear_and_done_ssa_iter (ptr);
> @@ -833,7 +833,7 @@ op_iter_init_phidef (ssa_op_iter *ptr, gphi *phi, int flags)
>   /* The first call to op_iter_next_def will terminate the iterator since
>      all the fields are NULL.  Simply return the result here as the first and
>      therefore only result.  */
> -  return PHI_RESULT_PTR (phi);
> +  return gimple_phi_result_ptr (phi);
> }
> 
> /* Return true is IMM has reached the end of the immediate use stmt list.  */
> diff --git a/gcc/tree-ssa-operands.h b/gcc/tree-ssa-operands.h
> index 8072932564a..b6534f18c66 100644
> --- a/gcc/tree-ssa-operands.h
> +++ b/gcc/tree-ssa-operands.h
> @@ -72,9 +72,8 @@ struct GTY(()) ssa_operands {
> #define USE_OP_PTR(OP)        (&((OP)->use_ptr))
> #define USE_OP(OP)        (USE_FROM_PTR (USE_OP_PTR (OP)))
> 
> -#define PHI_RESULT_PTR(PHI)    gimple_phi_result_ptr (PHI)
> -#define PHI_RESULT(PHI)        DEF_FROM_PTR (PHI_RESULT_PTR (PHI))
> -#define SET_PHI_RESULT(PHI, V)    SET_DEF (PHI_RESULT_PTR (PHI), (V))
> +#define PHI_RESULT(PHI)        gimple_phi_result (PHI)
> +#define SET_PHI_RESULT(PHI, V)    SET_DEF (gimple_phi_result_ptr (PHI), (V))
> /*
> #define PHI_ARG_DEF(PHI, I)    USE_FROM_PTR (PHI_ARG_DEF_PTR ((PHI), (I)))
> */
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/gcc/ssa-iterators.h b/gcc/ssa-iterators.h
index b7b01fd018a..e0e555cc472 100644
--- a/gcc/ssa-iterators.h
+++ b/gcc/ssa-iterators.h
@@ -768,7 +768,7 @@  num_ssa_operands (gimple *stmt, int flags)
 inline tree
 single_phi_def (gphi *stmt, int flags)
 {
-  tree def = PHI_RESULT (stmt);
+  tree def = gimple_phi_result (stmt);
   if ((flags & SSA_OP_DEF) && is_gimple_reg (def))
     return def;
   if ((flags & SSA_OP_VIRTUAL_DEFS) && !is_gimple_reg (def))
@@ -811,7 +811,7 @@  op_iter_init_phiuse (ssa_op_iter *ptr, gphi *phi, int flags)
 inline def_operand_p
 op_iter_init_phidef (ssa_op_iter *ptr, gphi *phi, int flags)
 {
-  tree phi_def = PHI_RESULT (phi);
+  tree phi_def = gimple_phi_result (phi);
   int comp;
 
   clear_and_done_ssa_iter (ptr);
@@ -833,7 +833,7 @@  op_iter_init_phidef (ssa_op_iter *ptr, gphi *phi, int flags)
   /* The first call to op_iter_next_def will terminate the iterator since
      all the fields are NULL.  Simply return the result here as the first and
      therefore only result.  */
-  return PHI_RESULT_PTR (phi);
+  return gimple_phi_result_ptr (phi);
 }
 
 /* Return true is IMM has reached the end of the immediate use stmt list.  */
diff --git a/gcc/tree-ssa-operands.h b/gcc/tree-ssa-operands.h
index 8072932564a..b6534f18c66 100644
--- a/gcc/tree-ssa-operands.h
+++ b/gcc/tree-ssa-operands.h
@@ -72,9 +72,8 @@  struct GTY(()) ssa_operands {
 #define USE_OP_PTR(OP)		(&((OP)->use_ptr))
 #define USE_OP(OP)		(USE_FROM_PTR (USE_OP_PTR (OP)))
 
-#define PHI_RESULT_PTR(PHI)	gimple_phi_result_ptr (PHI)
-#define PHI_RESULT(PHI)		DEF_FROM_PTR (PHI_RESULT_PTR (PHI))
-#define SET_PHI_RESULT(PHI, V)	SET_DEF (PHI_RESULT_PTR (PHI), (V))
+#define PHI_RESULT(PHI)		gimple_phi_result (PHI)
+#define SET_PHI_RESULT(PHI, V)	SET_DEF (gimple_phi_result_ptr (PHI), (V))
 /*
 #define PHI_ARG_DEF(PHI, I)	USE_FROM_PTR (PHI_ARG_DEF_PTR ((PHI), (I)))
 */