+2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
+
+ * combine.c: Include function-abi.h.
+ (record_dead_and_set_regs): Use insn_callee_abi to get the ABI
+ of the target of call insns. Invalidate partially-clobbered
+ registers as well as fully-clobbered ones.
+
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
* cfgloopanal.c: Include regs.h and function-abi.h.
#include "valtrack.h"
#include "rtl-iter.h"
#include "print-rtl.h"
+#include "function-abi.h"
/* Number of attempts to combine instructions in this function. */
if (CALL_P (insn))
{
+ HARD_REG_SET callee_clobbers
+ = insn_callee_abi (insn).full_and_partial_reg_clobbers ();
hard_reg_set_iterator hrsi;
- EXECUTE_IF_SET_IN_HARD_REG_SET (regs_invalidated_by_call, 0, i, hrsi)
+ EXECUTE_IF_SET_IN_HARD_REG_SET (callee_clobbers, 0, i, hrsi)
{
reg_stat_type *rsp;
+ /* ??? We could try to preserve some information from the last
+ set of register I if the call doesn't actually clobber
+ (reg:last_set_mode I), which might be true for ABIs with
+ partial clobbers. However, it would be difficult to
+ update last_set_nonzero_bits and last_sign_bit_copies
+ to account for the part of I that actually was clobbered.
+ It wouldn't help much anyway, since we rarely see this
+ situation before RA. */
rsp = ®_stat[i];
rsp->last_set_invalid = 1;
rsp->last_set = insn;