From: Richard Sandiford Date: Mon, 30 Sep 2019 16:20:19 +0000 (+0000) Subject: Remove global call sets: combine.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=212b7076eec027d212e1badb9cb5a9db4b62ab50;p=gcc.git Remove global call sets: combine.c There shouldn't be many cases in which a useful hard register is live across a call before RA, so we might as well keep things simple and invalidate partially-clobbered registers here, in case the values they hold leak into the call-clobbered part. In principle this is a bug fix for TARGET_HARD_REGNO_CALL_PART_CLOBBERED targets, but in practice it probably doesn't make a difference. 2019-09-30 Richard Sandiford gcc/ * 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. From-SVN: r276316 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6b08d70e11c..ed08c19bb40 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-09-30 Richard Sandiford + + * 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 * cfgloopanal.c: Include regs.h and function-abi.h. diff --git a/gcc/combine.c b/gcc/combine.c index 981e7b0ad9d..d200c5abd07 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -105,6 +105,7 @@ along with GCC; see the file COPYING3. If not see #include "valtrack.h" #include "rtl-iter.h" #include "print-rtl.h" +#include "function-abi.h" /* Number of attempts to combine instructions in this function. */ @@ -13464,11 +13465,21 @@ record_dead_and_set_regs (rtx_insn *insn) 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;