[PATCH] Fix PR33870, alias bug with SFTs and pointers
Daniel Berlin
dberlin@dberlin.org
Wed Oct 24 15:43:00 GMT 2007
On 10/24/07, Richard Guenther <rguenther@suse.de> wrote:
>
> While trying to grok the problem and possible solutions I went over
> set_uids_in_ptset where we do:
>
> static void
> set_uids_in_ptset (tree ptr, bitmap into, bitmap from, bool is_derefed,
> bool no_tbaa_pruning)
> {
> ...
> alias_set_type ptr_alias_set = get_alias_set (TREE_TYPE (ptr));
>
> EXECUTE_IF_SET_IN_BITMAP (from, 0, i, bi)
> {
> ...
> if (no_tbaa_pruning
> || (!is_derefed && !vi->directly_dereferenced)
> || alias_sets_conflict_p (ptr_alias_set, var_alias_set))
>
> that is, we ask for alias set conflicts of the pointer type with a
> pointed-to variable (or subvariable). This looks bogus. Ideally
> we want to ask
>
> ptr_alias_set = get_alias_set (build1 (INDIRECT_REF, TREE_TYPE
> (TREE_TYPE (ptr)), ptr));
>
> to also catch things like DECL_POINTER_ALIAS_SET, but probably just
> asking for get_alias_set (TREE_TYPE (TREE_TYPE (ptr))) should be
> good enough for a start.
Feel free to change it.
>
> Also we special case (!is_derefed && !vi->directly_dereferenced) which
> looks backward? Don't we want to add the alias if either is_derefed
> is set or vi->directly_dereferenced? That is,
>
> || is_derefed || vi->directly_dereferenced
We can't TBAA prune non-dereferenced variables.
Thus, we want to add it only if it is not dereferenced, or TBAA says it's okay.
Which is exactly what the test does.
>
> ?
>
> Thanks,
> Richard.
>
More information about the Gcc-patches
mailing list