cselib: Fix handling of multireg values for call insns [PR93170]
authorRichard Sandiford <richard.sandiford@arm.com>
Sat, 18 Jan 2020 10:59:10 +0000 (10:59 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Mon, 27 Jan 2020 10:53:34 +0000 (10:53 +0000)
commit150760dd6dd1899705790183d646fa5fc004554e
tree3b067c8902f0587db70d5992d8f42e36f4e93e49
parent7974a14692cec3ecafed24bc275df803373f3230
cselib: Fix handling of multireg values for call insns [PR93170]

g:3bd2918594dae34ae84f mishandled the case in which only the
tail end of a multireg hard register is invalidated by the call.
Walking all the entries should be both safer and more precise.

Avoiding cselib_invalidate_regno also means that we no longer
walk the same list multiple times (which is something we did
before g:3bd2918594dae34ae84f too).

2020-01-27  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR rtl-optimization/93170
* cselib.c (cselib_invalidate_regno_val): New function, split out
from...
(cselib_invalidate_regno): ...here.
(cselib_invalidated_by_call_p): New function.
(cselib_process_insn): Iterate over all the hard-register entries in
REG_VALUES and invalidate any that cross call-clobbered registers.

gcc/testsuite/
* gcc.dg/torture/pr93170.c: New test.
gcc/ChangeLog
gcc/cselib.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr93170.c [new file with mode: 0644]