On 02/28/2018 10:51 AM, Richard Sandiford wrote:
> RTL code needs to be consistent about whether it uses the stack
> pointer, the frame pointer or the argument pointer to access a
> given part of the frame.  alias.c used this to divide accesses
> into three independent areas.
> 
> The problem in the PR is that we did this for HARD_FRAME_POINTER_REGNUM
> even when the register wasn't being used as a frame pointer.  We can't
> do that because the frame pointer is then just any old allocatable
> register and could certainly point to info accessed through the
> argument pointer or stack pointer.
> 
> In this case the bug triggered wrong code, but diffing the before and after
> assembly output for one target per CPU shows that the bug also introduced
> an unnecessary scheduling dependence between B and C in things like:
> 
>       A: (set hfp (symbol_ref "..."))
>       B: ...(mem hfp)...
>       C: (clobber (mem sp))
> 
> where the hard frame pointer points to something that is obviously
> distinct from the frame.  So it looks like this patch is both a
> correctness fix and a very minor scheduling improvement.
> 
> Tested on aarch64-linux-gnu, and by diffing output as above.  OK to install?
> 
> Richard
> 
> 
> 2018-02-28  Richard Sandiford  <richard.sandif...@linaro.org>
> 
> gcc/
>       PR rtl-optimization/84538
>       * alias.c (init_alias_target): Add commentary.
>       (init_alias_analysis): Only give HARD_FRAME_POINTER_REGNUM
>       a unique base value if the frame pointer is not eliminated
>       to the stack pointer.
> 
> gcc/testsuite/
>       PR rtl-optimization/84538
>       * gcc.dg/torture/pr84538.c: New test.
OK.
jeff

Reply via email to