This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/6]tree-ssa-dom.c: Normalize exprs, starting with ARRAY_REF to MEM_REF
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Alan Lawrence <alan dot lawrence at arm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 30 Oct 2015 10:16:26 +0100
- Subject: Re: [PATCH 1/6]tree-ssa-dom.c: Normalize exprs, starting with ARRAY_REF to MEM_REF
- Authentication-results: sourceware.org; auth=none
- References: <1446146302-17002-1-git-send-email-alan dot lawrence at arm dot com> <1446146302-17002-2-git-send-email-alan dot lawrence at arm dot com> <563301AA dot 4050009 at redhat dot com>
On Fri, Oct 30, 2015 at 6:35 AM, Jeff Law <law@redhat.com> wrote:
> On 10/29/2015 01:18 PM, Alan Lawrence wrote:
>>
>> This patch just teaches DOM that ARRAY_REFs can be equivalent to MEM_REFs
>> (with
>> pointer type to the array element type).
>>
>> gcc/ChangeLog:
>>
>> * tree-ssa-dom.c (dom_normalize_single_rhs): New.
>> (dom_normalize_gimple_stmt): New.
>> (lookup_avail_expr): Call dom_normalize_gimple_stmt.
>
> Has this been tested? Do you have tests where it can be shown to make a
> difference independent of the changes to tree-sra.c?
>
> The implementation looks fine, I just want to have some basic tests in the
> testsuite that show the benefit of this normalization.
Err, I think the implementation is extremely wasteful ...
> Similarly for patch #2. Interestingly enough we had code that made that kind
> of transformation during gimplification eons ago. Presumably it was ripped
> out at some point because of the differences in aliasing properties.
Please have a look at how SCCVN handles variants of memory references.
You might even want to re-use it's copy_reference_ops_from_ref implementation
(and reference hashing). Note that SCCVN needs to be able to reconstruct a
tree expression from its representation (for PRE) which DOM needs not, so
DOM might use a simpler form. The basic idea is to accumulate constant
offset handled_components into a "offset component". Thus
a[2].i -> (&a)->offset(8 + offsetof(i))
MEM_REF[&a, 8].i -> (&a)->offset(8 + offsetof(i))
for DOM you can probably do the copy_reference_ops_from_ref work
on-the-fly for hashing and comparing. The main point will be to forgo
with the DOM way of hashing/comparing for memory references.
Richard.
>
>
> Jeff