phiopt: Use gphi *phi instead of gimple *phi some more

Message ID 20210506083437.GW1179226@tucnak
State New
Headers show
Series
  • phiopt: Use gphi *phi instead of gimple *phi some more
Related show

Commit Message

Sergei Trofimovich via Gcc-patches May 6, 2021, 8:34 a.m.
Hi!

Various functions in phiopt are also called with a gphi * but use
gimple * argument for it.  Fixed thusly, bootstrapped/regtested on
x86_64-linux and i686-linux, ok for trunk?

2021-05-06  Jakub Jelinek  <jakub@redhat.com>

	* tree-ssa-phiopt.c (value_replacement, minmax_replacement,
	abs_replacement, xor_replacement,
	cond_removal_in_popcount_clz_ctz_pattern,
	replace_phi_edge_with_variable): Change type of phi argument from
	gimple * to gphi *.


	Jakub

Comments

Richard Biener May 6, 2021, 10:13 a.m. | #1
On Thu, 6 May 2021, Jakub Jelinek wrote:

> Hi!

> 

> Various functions in phiopt are also called with a gphi * but use

> gimple * argument for it.  Fixed thusly, bootstrapped/regtested on

> x86_64-linux and i686-linux, ok for trunk?


Yes (obvious even).

Richard.

> 2021-05-06  Jakub Jelinek  <jakub@redhat.com>

> 

> 	* tree-ssa-phiopt.c (value_replacement, minmax_replacement,

> 	abs_replacement, xor_replacement,

> 	cond_removal_in_popcount_clz_ctz_pattern,

> 	replace_phi_edge_with_variable): Change type of phi argument from

> 	gimple * to gphi *.

> 

> --- gcc/tree-ssa-phiopt.c.jj	2021-05-05 15:06:23.253189139 +0200

> +++ gcc/tree-ssa-phiopt.c	2021-05-05 18:02:07.600019038 +0200

> @@ -57,23 +57,23 @@ static bool conditional_replacement (bas

>  static gphi *factor_out_conditional_conversion (edge, edge, gphi *, tree, tree,

>  						gimple *);

>  static int value_replacement (basic_block, basic_block,

> -			      edge, edge, gimple *, tree, tree);

> +			      edge, edge, gphi *, tree, tree);

>  static bool minmax_replacement (basic_block, basic_block,

> -				edge, edge, gimple *, tree, tree);

> +				edge, edge, gphi *, tree, tree);

>  static bool abs_replacement (basic_block, basic_block,

> -			     edge, edge, gimple *, tree, tree);

> +			     edge, edge, gphi *, tree, tree);

>  static bool xor_replacement (basic_block, basic_block,

> -			     edge, edge, gimple *, tree, tree);

> +			     edge, edge, gphi *, tree, tree);

>  static bool spaceship_replacement (basic_block, basic_block,

>  				   edge, edge, gphi *, tree, tree);

>  static bool cond_removal_in_popcount_clz_ctz_pattern (basic_block, basic_block,

> -						      edge, edge, gimple *,

> +						      edge, edge, gphi *,

>  						      tree, tree);

>  static bool cond_store_replacement (basic_block, basic_block, edge, edge,

>  				    hash_set<tree> *);

>  static bool cond_if_else_store_replacement (basic_block, basic_block, basic_block);

>  static hash_set<tree> * get_non_trapping ();

> -static void replace_phi_edge_with_variable (basic_block, edge, gimple *, tree);

> +static void replace_phi_edge_with_variable (basic_block, edge, gphi *, tree);

>  static void hoist_adjacent_loads (basic_block, basic_block,

>  				  basic_block, basic_block);

>  static bool gate_hoist_loads (void);

> @@ -389,7 +389,7 @@ tree_ssa_phiopt_worker (bool do_store_el

>  

>  static void

>  replace_phi_edge_with_variable (basic_block cond_block,

> -				edge e, gimple *phi, tree new_tree)

> +				edge e, gphi *phi, tree new_tree)

>  {

>    basic_block bb = gimple_bb (phi);

>    basic_block block_to_remove;

> @@ -1113,8 +1113,7 @@ absorbing_element_p (tree_code code, tre

>  

>  static int

>  value_replacement (basic_block cond_bb, basic_block middle_bb,

> -		   edge e0, edge e1, gimple *phi,

> -		   tree arg0, tree arg1)

> +		   edge e0, edge e1, gphi *phi, tree arg0, tree arg1)

>  {

>    gimple_stmt_iterator gsi;

>    gimple *cond;

> @@ -1422,8 +1421,7 @@ value_replacement (basic_block cond_bb,

>  

>  static bool

>  minmax_replacement (basic_block cond_bb, basic_block middle_bb,

> -		    edge e0, edge e1, gimple *phi,

> -		    tree arg0, tree arg1)

> +		    edge e0, edge e1, gphi *phi, tree arg0, tree arg1)

>  {

>    tree result;

>    edge true_edge, false_edge;

> @@ -2266,7 +2264,7 @@ spaceship_replacement (basic_block cond_

>  static bool

>  cond_removal_in_popcount_clz_ctz_pattern (basic_block cond_bb,

>  					  basic_block middle_bb,

> -					  edge e1, edge e2, gimple *phi,

> +					  edge e1, edge e2, gphi *phi,

>  					  tree arg0, tree arg1)

>  {

>    gimple *cond;

> @@ -2424,7 +2422,7 @@ cond_removal_in_popcount_clz_ctz_pattern

>  static bool

>  abs_replacement (basic_block cond_bb, basic_block middle_bb,

>  		 edge e0 ATTRIBUTE_UNUSED, edge e1,

> -		 gimple *phi, tree arg0, tree arg1)

> +		 gphi *phi, tree arg0, tree arg1)

>  {

>    tree result;

>    gassign *new_stmt;

> @@ -2548,7 +2546,7 @@ abs_replacement (basic_block cond_bb, ba

>  static bool

>  xor_replacement (basic_block cond_bb, basic_block middle_bb,

>  		 edge e0 ATTRIBUTE_UNUSED, edge e1,

> -		 gimple *phi, tree arg0, tree arg1)

> +		 gphi *phi, tree arg0, tree arg1)

>  {

>    if (!INTEGRAL_TYPE_P (TREE_TYPE (arg1)))

>      return false;

> 

> 	Jakub

> 

> 


-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)

Patch

--- gcc/tree-ssa-phiopt.c.jj	2021-05-05 15:06:23.253189139 +0200
+++ gcc/tree-ssa-phiopt.c	2021-05-05 18:02:07.600019038 +0200
@@ -57,23 +57,23 @@  static bool conditional_replacement (bas
 static gphi *factor_out_conditional_conversion (edge, edge, gphi *, tree, tree,
 						gimple *);
 static int value_replacement (basic_block, basic_block,
-			      edge, edge, gimple *, tree, tree);
+			      edge, edge, gphi *, tree, tree);
 static bool minmax_replacement (basic_block, basic_block,
-				edge, edge, gimple *, tree, tree);
+				edge, edge, gphi *, tree, tree);
 static bool abs_replacement (basic_block, basic_block,
-			     edge, edge, gimple *, tree, tree);
+			     edge, edge, gphi *, tree, tree);
 static bool xor_replacement (basic_block, basic_block,
-			     edge, edge, gimple *, tree, tree);
+			     edge, edge, gphi *, tree, tree);
 static bool spaceship_replacement (basic_block, basic_block,
 				   edge, edge, gphi *, tree, tree);
 static bool cond_removal_in_popcount_clz_ctz_pattern (basic_block, basic_block,
-						      edge, edge, gimple *,
+						      edge, edge, gphi *,
 						      tree, tree);
 static bool cond_store_replacement (basic_block, basic_block, edge, edge,
 				    hash_set<tree> *);
 static bool cond_if_else_store_replacement (basic_block, basic_block, basic_block);
 static hash_set<tree> * get_non_trapping ();
-static void replace_phi_edge_with_variable (basic_block, edge, gimple *, tree);
+static void replace_phi_edge_with_variable (basic_block, edge, gphi *, tree);
 static void hoist_adjacent_loads (basic_block, basic_block,
 				  basic_block, basic_block);
 static bool gate_hoist_loads (void);
@@ -389,7 +389,7 @@  tree_ssa_phiopt_worker (bool do_store_el
 
 static void
 replace_phi_edge_with_variable (basic_block cond_block,
-				edge e, gimple *phi, tree new_tree)
+				edge e, gphi *phi, tree new_tree)
 {
   basic_block bb = gimple_bb (phi);
   basic_block block_to_remove;
@@ -1113,8 +1113,7 @@  absorbing_element_p (tree_code code, tre
 
 static int
 value_replacement (basic_block cond_bb, basic_block middle_bb,
-		   edge e0, edge e1, gimple *phi,
-		   tree arg0, tree arg1)
+		   edge e0, edge e1, gphi *phi, tree arg0, tree arg1)
 {
   gimple_stmt_iterator gsi;
   gimple *cond;
@@ -1422,8 +1421,7 @@  value_replacement (basic_block cond_bb,
 
 static bool
 minmax_replacement (basic_block cond_bb, basic_block middle_bb,
-		    edge e0, edge e1, gimple *phi,
-		    tree arg0, tree arg1)
+		    edge e0, edge e1, gphi *phi, tree arg0, tree arg1)
 {
   tree result;
   edge true_edge, false_edge;
@@ -2266,7 +2264,7 @@  spaceship_replacement (basic_block cond_
 static bool
 cond_removal_in_popcount_clz_ctz_pattern (basic_block cond_bb,
 					  basic_block middle_bb,
-					  edge e1, edge e2, gimple *phi,
+					  edge e1, edge e2, gphi *phi,
 					  tree arg0, tree arg1)
 {
   gimple *cond;
@@ -2424,7 +2422,7 @@  cond_removal_in_popcount_clz_ctz_pattern
 static bool
 abs_replacement (basic_block cond_bb, basic_block middle_bb,
 		 edge e0 ATTRIBUTE_UNUSED, edge e1,
-		 gimple *phi, tree arg0, tree arg1)
+		 gphi *phi, tree arg0, tree arg1)
 {
   tree result;
   gassign *new_stmt;
@@ -2548,7 +2546,7 @@  abs_replacement (basic_block cond_bb, ba
 static bool
 xor_replacement (basic_block cond_bb, basic_block middle_bb,
 		 edge e0 ATTRIBUTE_UNUSED, edge e1,
-		 gimple *phi, tree arg0, tree arg1)
+		 gphi *phi, tree arg0, tree arg1)
 {
   if (!INTEGRAL_TYPE_P (TREE_TYPE (arg1)))
     return false;