Tighten use of HARD_FRAME_POINTER_REGNUM in alias.c (PR 84538)
commita70ee4f5c4ef447e248e705aa18a3643c663cc88
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Mar 2018 08:22:06 +0000 (1 08:22 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Mar 2018 08:22:06 +0000 (1 08:22 +0000)
tree351106ed56d48df57047be4534967c2e4d1300b3
parent95f18d43d2b5e64b61b25f55493f09e80874e07d
Tighten use of HARD_FRAME_POINTER_REGNUM in alias.c (PR 84538)

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.

2018-03-01  Richard Sandiford  <richard.sandiford@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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258094 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/alias.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr84538.c [new file with mode: 0644]