This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][PR tree-optimization/79578] Use operand_equal_p rather than pointer equality for base test
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 24 Feb 2017 11:04:23 +0100
- Subject: Re: [PATCH][PR tree-optimization/79578] Use operand_equal_p rather than pointer equality for base test
- Authentication-results: sourceware.org; auth=none
- References: <5d9c026a-12a7-d6f7-e1d7-da0382ac8f2a@redhat.com> <CAFiYyc1J0=Y0nxxH1xbUhPsZ-PU+N_7+Oc=o=XBrThgfq5BhYg@mail.gmail.com> <069f125b-f064-97da-7bbf-219fc15d6ff4@redhat.com>
On Thu, Feb 23, 2017 at 10:06 PM, Jeff Law <law@redhat.com> wrote:
> On 02/23/2017 02:02 AM, Richard Biener wrote:
>
>>> diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
>>> index 84c0b11..a82e164 100644
>>> --- a/gcc/tree-ssa-dse.c
>>> +++ b/gcc/tree-ssa-dse.c
>>> @@ -176,7 +176,7 @@ clear_bytes_written_by (sbitmap live_bytes, gimple
>>> *stmt, ao_ref *ref)
>>> /* Verify we have the same base memory address, the write
>>> has a known size and overlaps with REF. */
>>> if (valid_ao_ref_for_dse (&write)
>>> - && write.base == ref->base
>>> + && operand_equal_p (write.base, ref->base, 0)
>>
>>
>> As you've identified size and offset match you are really interested
>> in comparing the base addresses and thus should use OEP_ADDRESS_OF.
>
> I pondered that, but (perhaps incorrectly) thought that OEP_ADDRESS_OF was
> an optimization and that a more simple o_e_p with no flags was safer.
>
> I'm happy to change it, particularly if it's a correctness issue (in which
> case I think we've designed a horrible API for o_e_p, but such is life). In
> fact, I've already bootstrapped and regression tested that change.
It's indeed an optimization to use OEP_ADDRESS_OF and 0 is more conservative.
Richard.
> jeff
>