[PATCH] Do not create NMTs for pt_anything pointers
Daniel Berlin
dberlin@dberlin.org
Tue Jun 3 21:31:00 GMT 2008
So, the idea was to eventually remove SMT's entirely in favor of NMT's.
Prior to thi, the only place we created SMT's still was for globals
(that i remember).
As such, your patch seems like a step backwards.
Why should we bother to have SMT's anymore?
There is no real reason for them in the presence of a real list of aliases.
All having two types of "memory tags" did was confuse people who are
used to other compilers, which simply represent a set of aliases that
a symbol has.
Sure, SMT's are very slightly less memory intensive. I've yet to see
a case where NMT's were so memory hungry compared to SMT"s that using
SMT's was worth it.
On Tue, Jun 3, 2008 at 7:06 AM, Richard Guenther <rguenther@suse.de> wrote:
>
> This removes the creation of NMTs for pt_anything pointers. Previously
> we added the pointers SMT and its aliases to the set of pointed-to
> variables to account for the pt_anything-ness. But the SMT already
> contains any alias the pointer can alias and the operand scanner knows
> how to deal with NMT-less pointers by falling back to the pointers SMT
> (and thus using a pt_anything solution).
>
> Thus we can avoid creating the NMT and its (usually large) aliases bitmap
> for pt_anything pointers.
>
> Not creating these NMTs skews partitioning a little (less possibly
> aliased tags), so I have to xfail two subtests of the recently added
> alias-18.c test -- the --param max-aliased-vops=0 trick doesn't
> reliably trigger. I'll plan to fix that by tweaking the statement
> walker of the alias-oracle at some point in the future.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu. I'll apply this
> after some time for comments.
>
> Richard.
>
> 2008-06-03 Richard Guenther <rguenther@suse.de>
>
> * tree-ssa-structalias.c (merge_smts_into): Remove.
> (find_what_p_points_to): Do not bother to compute the
> points-to set for pt_anything pointers.
> * tree-ssa-operands.c (get_addr_dereference_operands): No NMT
> for pt_anything pointers is ok.
>
> * gcc.dg/tree-ssa/alias-18.c: XFAIL some sub-tests.
>
> Index: trunk/gcc/tree-ssa-structalias.c
> ===================================================================
> *** trunk.orig/gcc/tree-ssa-structalias.c 2008-05-30 21:53:47.000000000 +0200
> --- trunk/gcc/tree-ssa-structalias.c 2008-06-02 16:59:04.000000000 +0200
> *************** set_used_smts (void)
> *** 4741,4772 ****
> }
> }
>
> - /* Merge the necessary SMT's into the bitmap INTO, which is
> - P's varinfo. This involves merging all SMT's that are a subset of
> - the SMT necessary for P. */
> -
> - static void
> - merge_smts_into (tree p, bitmap solution)
> - {
> - tree smt;
> - bitmap aliases;
> - tree var = p;
> -
> - if (TREE_CODE (p) == SSA_NAME)
> - var = SSA_NAME_VAR (p);
> -
> - smt = var_ann (var)->symbol_mem_tag;
> - if (smt)
> - {
> - /* The smt itself isn't included in its aliases. */
> - bitmap_set_bit (solution, DECL_UID (smt));
> -
> - aliases = MTAG_ALIASES (smt);
> - if (aliases)
> - bitmap_ior_into (solution, aliases);
> - }
> - }
> -
> /* Given a pointer variable P, fill in its points-to set, or return
> false if we can't.
> Rather than return false for variables that point-to anything, we
> --- 4741,4746 ----
> *************** find_what_p_points_to (tree p)
> *** 4848,4866 ****
> }
> }
>
> /* Share the final set of variables when possible. */
> finished_solution = BITMAP_GGC_ALLOC ();
> stats.points_to_sets_created++;
>
> - /* Instead of using pt_anything, we merge in the SMT aliases
> - for the underlying SMT. In addition, if they could have
> - pointed to anything, they could point to global memory. */
> - if (was_pt_anything)
> - {
> - merge_smts_into (p, finished_solution);
> - pi->pt_global_mem = 1;
> - }
> -
> set_uids_in_ptset (p, finished_solution, vi->solution,
> vi->directly_dereferenced,
> vi->no_tbaa_pruning);
> --- 4822,4839 ----
> }
> }
>
> + /* Instead of doing extra work, simply do not create
> + points-to information for pt_anything pointers. This
> + will cause the operand scanner to fall back to the
> + type-based SMT and its aliases. Which is the best
> + we could do here for the points-to set as well. */
> + if (was_pt_anything)
> + return false;
> +
> /* Share the final set of variables when possible. */
> finished_solution = BITMAP_GGC_ALLOC ();
> stats.points_to_sets_created++;
>
> set_uids_in_ptset (p, finished_solution, vi->solution,
> vi->directly_dereferenced,
> vi->no_tbaa_pruning);
> Index: trunk/gcc/tree-ssa-operands.c
> ===================================================================
> *** trunk.orig/gcc/tree-ssa-operands.c 2008-05-23 14:07:48.000000000 +0200
> --- trunk/gcc/tree-ssa-operands.c 2008-06-02 16:59:04.000000000 +0200
> *************** get_addr_dereference_operands (tree stmt
> *** 1523,1529 ****
> if (dump_file
> && TREE_CODE (ptr) == SSA_NAME
> && (pi == NULL
> ! || pi->name_mem_tag == NULL_TREE))
> {
> fprintf (dump_file,
> "NOTE: no flow-sensitive alias info for ");
> --- 1523,1530 ----
> if (dump_file
> && TREE_CODE (ptr) == SSA_NAME
> && (pi == NULL
> ! || (pi->name_mem_tag == NULL_TREE
> ! && !pi->pt_anything)))
> {
> fprintf (dump_file,
> "NOTE: no flow-sensitive alias info for ");
> Index: trunk/gcc/testsuite/gcc.dg/tree-ssa/alias-18.c
> ===================================================================
> *** trunk.orig/gcc/testsuite/gcc.dg/tree-ssa/alias-18.c 2008-05-23 14:06:09.000000000 +0200
> --- trunk/gcc/testsuite/gcc.dg/tree-ssa/alias-18.c 2008-06-02 17:23:38.000000000 +0200
> *************** int test8 (struct A *p, int *q)
> *** 78,87 ****
>
> /* { dg-final { scan-tree-dump "with 0" "fre" } } */
> /* { dg-final { scan-tree-dump "with 1" "fre" { xfail *-*-* } } } */
> ! /* { dg-final { scan-tree-dump "with 3" "fre" } } */
> /* { dg-final { scan-tree-dump "with 4" "fre" } } */
> /* { dg-final { scan-tree-dump "with 5" "fre" } } */
> ! /* { dg-final { scan-tree-dump "with 8" "fre" } } */
> /* { dg-final { scan-tree-dump-not "return 2;" "optimized" } } */
> /* { dg-final { scan-tree-dump-not "return 6;" "optimized" } } */
> /* { dg-final { scan-tree-dump-not "return 7;" "optimized" } } */
> --- 78,87 ----
>
> /* { dg-final { scan-tree-dump "with 0" "fre" } } */
> /* { dg-final { scan-tree-dump "with 1" "fre" { xfail *-*-* } } } */
> ! /* { dg-final { scan-tree-dump "with 3" "fre" { xfail *-*-* } } } */
> /* { dg-final { scan-tree-dump "with 4" "fre" } } */
> /* { dg-final { scan-tree-dump "with 5" "fre" } } */
> ! /* { dg-final { scan-tree-dump "with 8" "fre" { xfail *-*-* } } } */
> /* { dg-final { scan-tree-dump-not "return 2;" "optimized" } } */
> /* { dg-final { scan-tree-dump-not "return 6;" "optimized" } } */
> /* { dg-final { scan-tree-dump-not "return 7;" "optimized" } } */
>
>
More information about the Gcc-patches
mailing list