This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix some of the PR33870 fix fallout
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: dnovillo at google dot com
- Date: Sun, 28 Oct 2007 22:40:20 +0100 (CET)
- Subject: Re: [PATCH] Fix some of the PR33870 fix fallout
- References: <Pine.LNX.4.64.0710281927460.4221@zhemvz.fhfr.qr>
On Sun, 28 Oct 2007, Richard Guenther wrote:
>
> The PR33870 fix caused quite some compile-time regressions. While
> this unfortunately cannot be avoided completely (at least without
> changing what we partition, and thus potentially causing runtime
> performance regressions), the following patch makes us re-consider
> a few less vars.
>
> It also fixes one potential problem, if we don't have flow-sensitive
> alias info, we shouldn't try to prune based on the offset/size from
> the referece as we really don't know what the pointer points to.
And we can do even better, noting that only if we start from NMTs we
need all the recursion and walking over all SFTs. Hopefully, if I
got this right. At least we'll get some testcases if this is not the
case.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to mainline.
Richard.
2007-10-28 Richard Guenther <rguenther@suse.de>
* tree-ssa-operands.c (add_vars_for_offset): Add parameter
telling if the var is to be treated as points-to location.
(add_vars_for_bitmap): Pass true to add_vars_for_offset.
(add_virtual_operand): Only recurse into MPTs if aliases
is from a NMT.
Index: tree-ssa-operands.c
===================================================================
*** tree-ssa-operands.c (revision 129702)
--- tree-ssa-operands.c (working copy)
*************** access_can_touch_variable (tree ref, tre
*** 1386,1396 ****
This is necessary because foop only actually points to foo's first
member, so that is all the points-to set contains. However, an access
to foop->a may be touching some single SFT if we have created some
! SFT's for a structure. */
static bool
add_vars_for_offset (tree full_ref, tree var, HOST_WIDE_INT offset,
! HOST_WIDE_INT size, bool is_call_site, bool is_def)
{
bool added = false;
subvar_t sv;
--- 1386,1397 ----
This is necessary because foop only actually points to foo's first
member, so that is all the points-to set contains. However, an access
to foop->a may be touching some single SFT if we have created some
! SFT's for a structure. If AS_PTO is false, just add VAR to the vops. */
static bool
add_vars_for_offset (tree full_ref, tree var, HOST_WIDE_INT offset,
! HOST_WIDE_INT size, bool is_call_site, bool is_def,
! bool as_pto)
{
bool added = false;
subvar_t sv;
*************** add_vars_for_offset (tree full_ref, tree
*** 1405,1411 ****
return false;
/* For SFTs we have to consider all subvariables of the parent var. */
! if (TREE_CODE (var) != STRUCT_FIELD_TAG)
{
/* If we do not know the full reference tree or if the access is
unspecified [0, -1], we cannot prune it. Otherwise try doing
--- 1406,1413 ----
return false;
/* For SFTs we have to consider all subvariables of the parent var. */
! if (TREE_CODE (var) != STRUCT_FIELD_TAG
! || !as_pto)
{
/* If we do not know the full reference tree or if the access is
unspecified [0, -1], we cannot prune it. Otherwise try doing
*************** add_vars_for_bitmap (bitmap aliases, tre
*** 1465,1471 ****
if (TREE_CODE (al) == STRUCT_FIELD_TAG)
*none_added &= !add_vars_for_offset (full_ref, al, offset, size,
! is_call_site, is_def);
}
}
--- 1467,1473 ----
if (TREE_CODE (al) == STRUCT_FIELD_TAG)
*none_added &= !add_vars_for_offset (full_ref, al, offset, size,
! is_call_site, is_def, true);
}
}
*************** add_virtual_operand (tree var, stmt_ann_
*** 1546,1557 ****
/* We have to consider SFTs inside MPTs as possible pointed-to
location as well because even if aliases does not contain
a single SFT, the SFTs inside the MPT may be incomplete in
! that not all aliased subvars have to be in this MPT, too. */
! if (TREE_CODE (al) == MEMORY_PARTITION_TAG)
add_vars_for_bitmap (MPT_SYMBOLS (al), full_ref, offset, size,
is_call_site, flags & opf_def, &none_added);
none_added &= !add_vars_for_offset (full_ref, al, offset, size,
! is_call_site, flags & opf_def);
}
if (flags & opf_def)
--- 1548,1562 ----
/* We have to consider SFTs inside MPTs as possible pointed-to
location as well because even if aliases does not contain
a single SFT, the SFTs inside the MPT may be incomplete in
! that not all aliased subvars have to be in this MPT, too.
! But only if we start with NMT aliases. */
! if (TREE_CODE (al) == MEMORY_PARTITION_TAG
! && TREE_CODE (var) == NAME_MEMORY_TAG)
add_vars_for_bitmap (MPT_SYMBOLS (al), full_ref, offset, size,
is_call_site, flags & opf_def, &none_added);
none_added &= !add_vars_for_offset (full_ref, al, offset, size,
! is_call_site, flags & opf_def,
! TREE_CODE (var) == NAME_MEMORY_TAG);
}
if (flags & opf_def)