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]

Re: [PATCH] Fix PR37869, wrong points-to results


LGTM

On Tue, Nov 25, 2008 at 6:36 PM, Richard Guenther <rguenther@suse.de> wrote:
>
> This fixes PR37869.  As analyzed by Danny a memory optimization in
> the points-to solver has implementation issues which causes us
> to compute empty points-to sets for random dereferenced pointers.
>
> The following patch simply removes this optimization.  Fixing it
> properly would need another intermediate bitmap, probably not
> worth the trouble.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu - ok for trunk?
>
> Thanks,
> Richard.
>
> 2008-11-25  Daniel Berlin  <dberlin@dberlin.org>
>        Richard Guenther  <rguenther@suse.de>
>
>        PR tree-optimization/37869
>        * tree-ssa-structalias.c (struct constraint_graph): Remove
>        pt_used and number_incoming members.
>        (build_pred_graph): Do not allocate them.
>        (condense_visit): Do not use them.
>        (label_visit): Likewise.
>        (free_var_substitution_info): Do not free them.
>
> Index: gcc/tree-ssa-structalias.c
> ===================================================================
> *** gcc/tree-ssa-structalias.c  (revision 142204)
> --- gcc/tree-ssa-structalias.c  (working copy)
> *************** struct constraint_graph
> *** 506,521 ****
>       taken.  Used for variable substitution.  */
>    bitmap address_taken;
>
> -   /* True if points_to bitmap for this node is stored in the hash
> -      table.  */
> -   sbitmap pt_used;
> -
> -   /* Number of incoming edges remaining to be processed by pointer
> -      equivalence.
> -      Used for variable substitution.  */
> -   unsigned int *number_incoming;
> -
> -
>    /* Vector of complex constraints for each graph node.  Complex
>       constraints are those involving dereferences or offsets that are
>       not 0.  */
> --- 506,511 ----
> *************** build_pred_graph (void)
> *** 1101,1111 ****
>    graph->points_to = XCNEWVEC (bitmap, graph->size);
>    graph->eq_rep = XNEWVEC (int, graph->size);
>    graph->direct_nodes = sbitmap_alloc (graph->size);
> -   graph->pt_used = sbitmap_alloc (graph->size);
>    graph->address_taken = BITMAP_ALLOC (&predbitmap_obstack);
> -   graph->number_incoming = XCNEWVEC (unsigned int, graph->size);
>    sbitmap_zero (graph->direct_nodes);
> -   sbitmap_zero (graph->pt_used);
>
>    for (j = 0; j < FIRST_REF_NODE; j++)
>      {
> --- 1091,1098 ----
> *************** condense_visit (constraint_graph_t graph
> *** 2008,2018 ****
>              bitmap_ior_into (graph->points_to[n],
>                               graph->points_to[w]);
>            }
> -         EXECUTE_IF_IN_NONNULL_BITMAP (graph->preds[n], 0, i, bi)
> -           {
> -             unsigned int rep = si->node_mapping[i];
> -             graph->number_incoming[rep]++;
> -           }
>        }
>        SET_BIT (si->deleted, n);
>      }
> --- 1995,2000 ----
> *************** label_visit (constraint_graph_t graph, s
> *** 2041,2061 ****
>
>        /* Skip unused edges  */
>        if (w == n || graph->pointer_label[w] == 0)
> !       {
> !         graph->number_incoming[w]--;
> !         continue;
> !       }
>        if (graph->points_to[w])
>        bitmap_ior_into(graph->points_to[n], graph->points_to[w]);
> -
> -       /* If all incoming edges to w have been processed and
> -        graph->points_to[w] was not stored in the hash table, we can
> -        free it.  */
> -       graph->number_incoming[w]--;
> -       if (!graph->number_incoming[w] && !TEST_BIT (graph->pt_used, w))
> -       {
> -         BITMAP_FREE (graph->points_to[w]);
> -       }
>      }
>    /* Indirect nodes get fresh variables.  */
>    if (!TEST_BIT (graph->direct_nodes, n))
> --- 2023,2032 ----
>
>        /* Skip unused edges  */
>        if (w == n || graph->pointer_label[w] == 0)
> !       continue;
> !
>        if (graph->points_to[w])
>        bitmap_ior_into(graph->points_to[n], graph->points_to[w]);
>      }
>    /* Indirect nodes get fresh variables.  */
>    if (!TEST_BIT (graph->direct_nodes, n))
> *************** label_visit (constraint_graph_t graph, s
> *** 2067,2073 ****
>                                               graph->points_to[n]);
>        if (!label)
>        {
> -         SET_BIT (graph->pt_used, n);
>          label = pointer_equiv_class++;
>          equiv_class_add (pointer_equiv_class_table,
>                           label, graph->points_to[n]);
> --- 2038,2043 ----
> *************** free_var_substitution_info (struct scc_i
> *** 2193,2202 ****
>    free (graph->loc_label);
>    free (graph->pointed_by);
>    free (graph->points_to);
> -   free (graph->number_incoming);
>    free (graph->eq_rep);
>    sbitmap_free (graph->direct_nodes);
> -   sbitmap_free (graph->pt_used);
>    htab_delete (pointer_equiv_class_table);
>    htab_delete (location_equiv_class_table);
>    bitmap_obstack_release (&iteration_obstack);
> --- 2163,2170 ----
>


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