Don't double-count early-clobber matches.
commit3dfcf76a47bee59642b61d80f5b5b52521ebc598
authorams <ams@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Oct 2018 14:23:37 +0000 (22 14:23 +0000)
committerams <ams@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Oct 2018 14:23:37 +0000 (22 14:23 +0000)
tree4ee7d0adc73737b64c868a7ecf0097a9fa860893
parent17c74aecf68fb0f92c40460f81b2886c171f63f9
Don't double-count early-clobber matches.

Given a pattern with a number of operands:

(match_operand 0 "" "=&v")
(match_operand 1 "" " v0")
(match_operand 2 "" " v0")
(match_operand 3 "" " v0")

GCC will currently increment "reject" once, for operand 0, and then decrement
it once for each of the other operands, ending with reject == -2 and an
assertion failure.  If there's a conflict then it might try to decrement reject
yet again.

Incidentally, what these patterns are trying to achieve is an allocation in
which operand 0 may match one of the other operands, but may not partially
overlap any of them.  Ideally there'd be a better way to do this.

In any case, it will affect any pattern in which multiple operands may (or
must) match an early-clobber operand.

The patch only allows a reject-- when one has not already occurred, for that
operand.

2018-10-22  Andrew Stubbs  <ams@codesourcery.com>

gcc/
* lra-constraints.c (process_alt_operands): New local array,
matching_early_clobber.  Check matching_early_clobber before
decrementing reject, and set matching_early_clobber after.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@265393 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/lra-constraints.c