https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70048
Jiong Wang <jiwang at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jiwang at gcc dot gnu.org
--- Comment #7 from Jiong Wang <jiwang at gcc dot gnu.org> ---
(In reply to Richard Henderson from comment #6)
> Created attachment 37886 [details]
> proposed patch
>
> I agree -- at minimum virtual and eliminable frame registers ought to be
> special-cased. If we separate the constants too far, we'll never be able
> to fold the constant plus the adjustment back together.
>
> If the statement in #c4 is taken at face value -- that r233136 was applied
> to simplify frame-based array accesses... Well, I simply don't believe
> that.
>
> I can see how the patch would aid reduction of access to members of a
> structure that are in an array which in turn is *not* on the stack. But
> for the average stack-based access I can't see except that it would hurt.
(In reply to Richard Henderson from comment #6)
> Created attachment 37886 [details]
> proposed patch
>
> I agree -- at minimum virtual and eliminable frame registers ought to be
> special-cased. If we separate the constants too far, we'll never be able
> to fold the constant plus the adjustment back together.
>
> If the statement in #c4 is taken at face value -- that r233136 was applied
> to simplify frame-based array accesses... Well, I simply don't believe
> that.
>
> I can see how the patch would aid reduction of access to members of a
> structure that are in an array which in turn is *not* on the stack. But
> for the average stack-based access I can't see except that it would hurt.
Richard,
There is a similar hunk in aarch64 TARGET_LEGITIMATE_ADDRESS_P implementation
(the "case PLUS" in aarch64_classify_address) which allows virtual frame
reference be with any constant offset.
if (! strict_p
&& REG_P (op0)
&& (op0 == virtual_stack_vars_rtx
|| op0 == frame_pointer_rtx
|| op0 == arg_pointer_rtx)
Looks to me, your patch have handled situations where op0 are
virtual_stack_dynamic_rtx and virtual_outgoing_args_rtx as well. Suppose offset
elimination will happen on these two, then I think we should update the code in
TARGET_LEGITIMATE_ADDRESS_P to use the same checks in your patch, then the two
places are consitent.