public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Cleanup compute_points_to_sets
@ 2021-10-19 12:35 Jan Hubicka
  2021-10-19 13:44 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Hubicka @ 2021-10-19 12:35 UTC (permalink / raw)
  To: gcc-patches

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?

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));
 	    }
 	}
     }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Cleanup compute_points_to_sets
  2021-10-19 12:35 Cleanup compute_points_to_sets Jan Hubicka
@ 2021-10-19 13:44 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2021-10-19 13:44 UTC (permalink / raw)
  To: Jan Hubicka, Jan Hubicka via Gcc-patches, gcc-patches

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));
> 	    }
> 	}
>     }


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-19 13:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19 12:35 Cleanup compute_points_to_sets Jan Hubicka
2021-10-19 13:44 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).