Remove global call sets: loop-iv.c
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 30 Sep 2019 16:20:56 +0000 (16:20 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 30 Sep 2019 16:20:56 +0000 (16:20 +0000)
Similar idea to the combine.c and gcse.c patches.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* loop-iv.c: Include regs.h and function-abi.h.
(simplify_using_initial_values): Use insn_callee_abi to get the
ABI of the call insn target.  Conservatively assume that
partially-clobbered registers are altered.

From-SVN: r276326

gcc/ChangeLog
gcc/loop-iv.c

index c0454ce7d9bf7eacd2dc157a6411d39708d5f22b..1129ec5daeef0ba0a0b65a422c9c079fcafb2ae6 100644 (file)
@@ -1,3 +1,10 @@
+2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * loop-iv.c: Include regs.h and function-abi.h.
+       (simplify_using_initial_values): Use insn_callee_abi to get the
+       ABI of the call insn target.  Conservatively assume that
+       partially-clobbered registers are altered.
+
 2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>
 
        * function-abi.h (call_clobbers_in_region): Declare.
index 33be75add72cbf2a61cfc2f705d7b9b09c157b4b..d0e69940c723c46f8b78103c87c9595c370e3958 100644 (file)
@@ -62,6 +62,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "dumpfile.h"
 #include "rtl-iter.h"
 #include "tree-ssa-loop-niter.h"
+#include "regs.h"
+#include "function-abi.h"
 
 /* Possible return values of iv_get_reaching_def.  */
 
@@ -1972,8 +1974,14 @@ simplify_using_initial_values (class loop *loop, enum rtx_code op, rtx *expr)
          CLEAR_REG_SET (this_altered);
          note_stores (insn, mark_altered, this_altered);
          if (CALL_P (insn))
-           /* Kill all call clobbered registers.  */
-           IOR_REG_SET_HRS (this_altered, regs_invalidated_by_call);
+           {
+             /* Kill all registers that might be clobbered by the call.
+                We don't track modes of hard registers, so we need to be
+                conservative and assume that partial kills are full kills.  */
+             function_abi callee_abi = insn_callee_abi (insn);
+             IOR_REG_SET_HRS (this_altered,
+                              callee_abi.full_and_partial_reg_clobbers ());
+           }
 
          if (suitable_set_for_replacement (insn, &dest, &src))
            {