This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 8/9] Add TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Jeff Law <law at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 14 Oct 2015 11:22:15 +0200
- Subject: Re: [PATCH 8/9] Add TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID
- Authentication-results: sourceware.org; auth=none
- References: <1444280375-20866-1-git-send-email-rth at redhat dot com> <1444280375-20866-9-git-send-email-rth at redhat dot com> <CAFiYyc2fi-0WLEm4ruH1tPn8prORbW-SUd3h2iqfrqiZg9imbw at mail dot gmail dot com> <5616DBBE dot 9080309 at redhat dot com> <CAFiYyc1xeSmHopajQm69ZJX9TjZizvB15RzAxGYhovnSykm1dA at mail dot gmail dot com> <561C41DD dot 5000505 at redhat dot com> <CAFiYyc1tafTBDTP=3meL2Yrbc+eM+n93uBG3ku1_axXGVRXkvQ at mail dot gmail dot com> <561D27EE dot 8030608 at redhat dot com> <561D7095 dot 8080401 at redhat dot com> <CAFiYyc3qgmofZPxE8a71oWhPJEBf1xESinGSA_w5K2Kw8X+xGg at mail dot gmail dot com>
On Wed, Oct 14, 2015 at 11:19 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Tue, Oct 13, 2015 at 10:59 PM, Richard Henderson <rth@redhat.com> wrote:
>> On 10/14/2015 02:49 AM, Jeff Law wrote:
>>>
>>> The problem here is we don't know what address space the *0 is going to
>>> hit,
>>> right?
>>
>>
>> Correct, not before we do the walk of stmt to see what's present.
>>
>>> Isn't that also an issue for code generation as well?
>>
>>
>> What sort of problem are you thinking of? I haven't seen one yet.
>
> The actual dereference of course has a properly address-space qualified zero.
>
> Only your walking depends on operand_equal_p to treat different address-space
> zero addresses as equal (which they are of course not ...):
>
>
> int
> operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
> {
> ...
> /* Check equality of integer constants before bailing out due to
> precision differences. */
> if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
> {
> /* Address of INTEGER_CST is not defined; check that we did not forget
> to drop the OEP_ADDRESS_OF/OEP_CONSTANT_ADDRESS_OF flags. */
> gcc_checking_assert (!(flags
> & (OEP_ADDRESS_OF | OEP_CONSTANT_ADDRESS_OF)));
> return tree_int_cst_equal (arg0, arg1);
> }
>
> but only later we do
>
> /* We cannot consider pointers to different address space equal. */
> if (POINTER_TYPE_P (TREE_TYPE (arg0))
> && POINTER_TYPE_P (TREE_TYPE (arg1))
> && (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg0)))
> != TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg1)))))
> return 0;
>
> So "fixing" that would make the walker only look for default
> address-space zero dereferences.
>
> I think we need to fix operand_equal_p anyway because 0 is clearly not
> equal to 0 (only if
> they convert to the same literal)
I think you could trigger bogus CSE of dereferences of literal addresses
from different address-spaces.
Richard.
> Richard.
>
>
>>
>> r~