This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix PR 33870
On Wed, 14 Nov 2007, Diego Novillo wrote:
> Richard Guenther wrote:
>
> > Bootstrap and regtest on x86_64-unknown-linux-gnu in progress, I intend
> > to commit this if that (as expected) finishes successfully.
>
> No, let me study this first.
We can also add one additional optimization and sanity check. In
add_virtual_operand instead of dispatching to add_vars_for_offset for
every SFT in the NMT just do so for those that have
SFT_BASE_FOR_COMPONENTS_P set. All others can (should) be only directly
dereferenced which means offset has to be zero. If not, we should
visit them during one of the add_vars_for_offset calls. This avoids
redundant calls to append_vuse/vdef (so it's merely a compile-time
improvement):
/* For SFTs we have to consider all subvariables of the parent
var
if it is a potential points-to location. */
if (TREE_CODE (al) == STRUCT_FIELD_TAG
&& TREE_CODE (var) == NAME_MEMORY_TAG)
{
if (SFT_BASE_FOR_COMPONENTS_P (al))
none_added &= !add_vars_for_offset (al, offset, size,
flags & opf_def);
else if (offset == 0)
{
/* If this is a SFT that cannot be used as a base for
component references, we only need to consider them
if offset is zero. Otherwise if it is aliased via
a component ref we will visit it during processing
of a SFT_BASE_FOR_COMPONENTS_P pointed-to SFT.
In this case just add this SFT as a possible direct
dereference target. */
if (flags & opf_def)
append_vdef (al);
else
append_vuse (al);
none_added = false;
}
I guess we don't want to do this as part of the initial patch, but I'll
check the compile-time effects if the above works out.
Richard.