This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Removing redundant loads
- From: law at redhat dot com
- To: Jason Merrill <jason at redhat dot com>
- Cc: Diego Novillo <dnovillo at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 30 May 2003 09:15:42 -0600
- Subject: Re: [tree-ssa] Removing redundant loads
- Reply-to: law at redhat dot com
In message <wvlwug8323r.fsf@prospero.boston.redhat.com>, Jason Merrill writes:
>On Fri, 30 May 2003 08:13:37 -0600, law@redhat.com wrote:
>
>> The fundamental problem is while iterative_hash_expr knows how to deal with
>> commutative operations, avail_expr_hash does not. Thus we get different
>> hashes because the order of operands in the use operands array is different
>> between the two statements. Ugh. We're probably going to have the same
>> problem with VUSE/VDEFs.
>
>A simple fix would be to combine the hashes for the operands in a
>commutative way, such as addition or xor, rather than feed the previous
>value back into iterative_hash_*.
For the real uses, I'm just going to have avail_expr_hash use
iterative_hash_expr, which already does the right thing. It seems kindof
silly to duplicate the code.
Yes, we're probably going to have to sort the virtual operands. What fun.
>Of course, avail_expr_eq will also need to deal with this issue; perhaps
>sorting the ops/vops vecs is the way to go.
Yes, avail_expr_eq has the same issue, but it's a little more "interesting"
in that we call back to simple_cst_equal which doesn't handle commutative
expressions well.
In a lot of ways this argues that we should have a canonical form for
commutative expressions, but I'm not quite annoyed enough yet to make
that invasive of a change.
Jeff