[PR81611] turn inc-and-use-of-dead-orig into auto-inc
commitd4ce94c11ee540c09e598f73d957a89ede66a9a5
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Feb 2018 05:25:34 +0000 (28 05:25 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Feb 2018 05:25:34 +0000 (28 05:25 +0000)
tree40df4cf8fec16353d624d51f5666f0b4d39adef8
parentfa3aa4e118f91b3a1b1357a974386c5530db8bc6
[PR81611] turn inc-and-use-of-dead-orig into auto-inc

When the addressing modes available on the machine don't allow offsets
in addresses, odds are that post-increments will be represented in
trees and RTL as:

  y <= x + 1
  ... *(x) ...
  x <= y

so deal with it by turning such RTL as:

  (set y (plus x n))
  ... (mem x) ...

without intervening uses of y into

  (set y x)
  ... (mem (post_add y n)) ...

so as to create auto-inc addresses that we'd otherwise miss.

for  gcc/ChangeLog

PR rtl-optimization/81611
* auto-inc-dec.c (attempt_change): Move dead note from
mem_insn if it's the next use of regno
(find_address): Take address use of reg holding
non-incremented value.  Add parm to limit search to the named
reg only.
(merge_in_block): Attempt to use a mem insn that is the next
use of the original regno.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258053 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/auto-inc-dec.c