Cleanup compute_points_to_sets

Richard Biener richard.guenther@gmail.com
Tue Oct 19 13:44:53 GMT 2021


On October 19, 2021 2:35:47 PM GMT+02:00, Jan Hubicka via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>Hi,
>this patch fixes two issues I noticed while proofreading the code.
>First is that I have added conditional around setting of nonlocal and
>escaped flags (since they may be set from solver) while keeping the
>variable in assignment that is confusing.
>
>Second is that we still do not set pt in the case function has no memory
>side effects.  In this case the call use is not going to be used since
>uses_global_memory is false only if either function is const or modref
>determined that all loads are from memory pointed to by parameters.  In
>both cases we will disambiguate earlier before asking PTA oracle, but it
>is better to avoid stale PTA sets (which shows in -alias dumps etc.)
>
>Most of builtins are not modifying global memory, one option would be to
>stick another flag into the fnspecs strings for this property.
>
>Bootstrapped/regtested x86_64-linux, OK?

Ok. 

Richard. 

>Honza
>
>gcc/ChangeLog:
>
>	* tree-ssa-structalias.c (compute_points_to_sets): Cleanup.
>
>diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
>index 2e6513bb72a..35971a54e02 100644
>--- a/gcc/tree-ssa-structalias.c
>+++ b/gcc/tree-ssa-structalias.c
>@@ -7550,8 +7550,8 @@ compute_points_to_sets (void)
> 		     always escaped.  */
> 		  if (uses_global_memory)
> 		    {
>-		      pt->nonlocal = uses_global_memory;
>-		      pt->escaped = uses_global_memory;
>+		      pt->nonlocal = 1;
>+		      pt->escaped = 1;
> 		    }
> 		}
> 	      else if (uses_global_memory)
>@@ -7561,6 +7561,8 @@ compute_points_to_sets (void)
> 		  *pt = cfun->gimple_df->escaped;
> 		  pt->nonlocal = 1;
> 		}
>+	      else
>+		memset (pt, 0, sizeof (struct pt_solution));
> 	    }
> 
> 	  pt = gimple_call_clobber_set (stmt);
>@@ -7582,8 +7584,8 @@ compute_points_to_sets (void)
> 		     always escaped.  */
> 		  if (writes_global_memory)
> 		    {
>-		      pt->nonlocal = writes_global_memory;
>-		      pt->escaped = writes_global_memory;
>+		      pt->nonlocal = 1;
>+		      pt->escaped = 1;
> 		    }
> 		}
> 	      else if (writes_global_memory)
>@@ -7593,6 +7595,8 @@ compute_points_to_sets (void)
> 		  *pt = cfun->gimple_df->escaped;
> 		  pt->nonlocal = 1;
> 		}
>+	      else
>+		memset (pt, 0, sizeof (struct pt_solution));
> 	    }
> 	}
>     }



More information about the Gcc-patches mailing list