diff mbox

[1/5] Refactor completely_scalarize_var

Message ID 1440500777-25966-2-git-send-email-alan.lawrence@arm.com
State New
Headers show

Commit Message

Alan Lawrence Aug. 25, 2015, 11:06 a.m. UTC
This is a small refactoring/renaming patch, it just moves the call to
"completely_scalarize_record" out from completely_scalarize_var, and renames
the latter to create_total_scalarization_access.

This is because the next patch needs to drop the "_record" suffix and I felt
it would be confusing to have both completely_scalarize and
completely_scalarize_var. However, it also makes the new function name
(create_total_scalarization_access) consistent with the existing code & comment.

Bootstrapped + check-gcc on x86_64.

gcc/ChangeLog:

	* tree-sra.c (completely_scalarize_var): Rename to...
	(create_total_scalarization_access): ... Here. Drop call to
	completely_scalarize_record.

	(analyze_all_variable_accesses): Replace completely_scalarize_var
	with create_total_scalarization_access and completely_scalarize_record.
---
 gcc/tree-sra.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Jeff Law Aug. 25, 2015, 7:18 p.m. UTC | #1
On 08/25/2015 05:06 AM, Alan Lawrence wrote:
> This is a small refactoring/renaming patch, it just moves the call to
> "completely_scalarize_record" out from completely_scalarize_var, and renames
> the latter to create_total_scalarization_access.
>
> This is because the next patch needs to drop the "_record" suffix and I felt
> it would be confusing to have both completely_scalarize and
> completely_scalarize_var. However, it also makes the new function name
> (create_total_scalarization_access) consistent with the existing code & comment.
>
> Bootstrapped + check-gcc on x86_64.
>
> gcc/ChangeLog:
>
> 	* tree-sra.c (completely_scalarize_var): Rename to...
> 	(create_total_scalarization_access): ... Here. Drop call to
> 	completely_scalarize_record.
>
> 	(analyze_all_variable_accesses): Replace completely_scalarize_var
> 	with create_total_scalarization_access and completely_scalarize_record.
OK.
Jeff
Martin Jambor Aug. 25, 2015, 9:40 p.m. UTC | #2
Hi,

On Tue, Aug 25, 2015 at 12:06:13PM +0100, Alan Lawrence wrote:
> This is a small refactoring/renaming patch, it just moves the call to
> "completely_scalarize_record" out from completely_scalarize_var, and renames
> the latter to create_total_scalarization_access.
> 
> This is because the next patch needs to drop the "_record" suffix and I felt
> it would be confusing to have both completely_scalarize and
> completely_scalarize_var. However, it also makes the new function name
> (create_total_scalarization_access) consistent with the existing code & comment.
> 
> Bootstrapped + check-gcc on x86_64.
> 
> gcc/ChangeLog:
> 
> 	* tree-sra.c (completely_scalarize_var): Rename to...
> 	(create_total_scalarization_access): ... Here. Drop call to
> 	completely_scalarize_record.
> 
> 	(analyze_all_variable_accesses): Replace completely_scalarize_var
> 	with create_total_scalarization_access and completely_scalarize_record.
> ---
>  gcc/tree-sra.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
> index 818c290..a0c92b0 100644
> --- a/gcc/tree-sra.c
> +++ b/gcc/tree-sra.c
> @@ -985,7 +985,7 @@ completely_scalarize_record (tree base, tree decl, HOST_WIDE_INT offset,
>     type_consists_of_records_p.   */
>  
>  static void
> -completely_scalarize_var (tree var)
> +create_total_scalarization_access (tree var)

If you change what the function does, you have to change the comment
too.  If I am not mistaken, even with the whole patch set applied, the
first sentence would still be: "Create total_scalarization accesses
for all scalar type fields in VAR and for VAR as a whole." And with
this change, only the part after "and" will remain true.

Thanks,

Martin

>  {
>    HOST_WIDE_INT size = tree_to_uhwi (DECL_SIZE (var));
>    struct access *access;
> @@ -994,8 +994,6 @@ completely_scalarize_var (tree var)
>    access->expr = var;
>    access->type = TREE_TYPE (var);
>    access->grp_total_scalarization = 1;
> -
> -  completely_scalarize_record (var, var, 0, var);
>  }
>  
>  /* Return true if REF has an VIEW_CONVERT_EXPR somewhere in it.  */
> @@ -2529,7 +2527,8 @@ analyze_all_variable_accesses (void)
>  	    if (tree_to_uhwi (TYPE_SIZE (TREE_TYPE (var)))
>  		<= max_scalarization_size)
>  	      {
> -		completely_scalarize_var (var);
> +		create_total_scalarization_access (var);
> +		completely_scalarize_record (var, var, 0, var);
>  		if (dump_file && (dump_flags & TDF_DETAILS))
>  		  {
>  		    fprintf (dump_file, "Will attempt to totally scalarize ");
> -- 
> 1.8.3
>
diff mbox

Patch

diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 818c290..a0c92b0 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -985,7 +985,7 @@  completely_scalarize_record (tree base, tree decl, HOST_WIDE_INT offset,
    type_consists_of_records_p.   */
 
 static void
-completely_scalarize_var (tree var)
+create_total_scalarization_access (tree var)
 {
   HOST_WIDE_INT size = tree_to_uhwi (DECL_SIZE (var));
   struct access *access;
@@ -994,8 +994,6 @@  completely_scalarize_var (tree var)
   access->expr = var;
   access->type = TREE_TYPE (var);
   access->grp_total_scalarization = 1;
-
-  completely_scalarize_record (var, var, 0, var);
 }
 
 /* Return true if REF has an VIEW_CONVERT_EXPR somewhere in it.  */
@@ -2529,7 +2527,8 @@  analyze_all_variable_accesses (void)
 	    if (tree_to_uhwi (TYPE_SIZE (TREE_TYPE (var)))
 		<= max_scalarization_size)
 	      {
-		completely_scalarize_var (var);
+		create_total_scalarization_access (var);
+		completely_scalarize_record (var, var, 0, var);
 		if (dump_file && (dump_flags & TDF_DETAILS))
 		  {
 		    fprintf (dump_file, "Will attempt to totally scalarize ");