This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[20/32] Remove global call sets: loop-iv.c

Similar idea to the combine.c and gcse.c patches.

2019-09-11  Richard Sandiford  <>

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

Index: gcc/loop-iv.c
--- gcc/loop-iv.c	2019-09-09 19:01:40.371078272 +0100
+++ gcc/loop-iv.c	2019-09-11 19:48:35.161764168 +0100
@@ -62,6 +62,8 @@ Free Software Foundation; either version
 #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 loo
 	  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 abi = call_insn_abi (insn);
+	      IOR_REG_SET_HRS (this_altered,
+			       abi.full_and_partial_reg_clobbers ());
+	    }
 	  if (suitable_set_for_replacement (insn, &dest, &src))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]