This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix TBAA pruning of points-to set


This (split out from the 33870 fix) patch fixes TBAA pruning which
is currently using the wrong alias type (of the pointer, instead of
the pointed-to type).  We miscompile the two c-torture testcases from
33870 (after the fix) because we TBAA prune the SFT we made sure we
retain to get correct operand scanning (as int does not alias PgHdr *).

Looking at this issue closer I realize that we call set_uids_in_ptset
with the decl from the collapsed solution, which can in some cases
be a non-pointer(!).  I think it doesn't make sense to do TBAA pruning
on the decl of the collapsed-into varinfo, but we want to use the
original pointer here.

So, bootstrapped and tested on x86_64-unknown-linux-gnu, applied to
mainline.  Not.  But tomorrow.

Thanks,
Richard.

2007-11-14  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-structalias.c (set_uids_in_ptset): Use the pointed-to
	type for TBAA pruning.
	(find_what_p_points_to): Call set_uids_in_ptset with the original
	pointer, not the decl of the solution we collapsed to.

Index: tree-ssa-structalias.c
===================================================================
--- tree-ssa-structalias.c	(revision 130174)
+++ tree-ssa-structalias.c	(working copy)
@@ -4719,7 +4719,10 @@ set_uids_in_ptset (tree ptr, bitmap into
 {
   unsigned int i;
   bitmap_iterator bi;
-  alias_set_type ptr_alias_set = get_alias_set (TREE_TYPE (ptr));
+  alias_set_type ptr_alias_set;
+
+  gcc_assert (POINTER_TYPE_P (TREE_TYPE (ptr)));
+  ptr_alias_set = get_alias_set (TREE_TYPE (TREE_TYPE (ptr)));
 
   EXECUTE_IF_SET_IN_BITMAP (from, 0, i, bi)
     {
@@ -4996,7 +4999,7 @@ find_what_p_points_to (tree p)
 	      pi->pt_global_mem = 1;
 	    }
 
-	  set_uids_in_ptset (vi->decl, finished_solution, vi->solution,
+	  set_uids_in_ptset (p, finished_solution, vi->solution,
 			     vi->directly_dereferenced,
 			     vi->no_tbaa_pruning);
 	  result = shared_bitmap_lookup (finished_solution);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]