diff options
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/sched-deps.c | 18 | ||||
-rw-r--r-- | gcc/sched-int.h | 1 | ||||
-rw-r--r-- | gcc/sel-sched-ir.c | 26 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr64411.C | 27 |
6 files changed, 79 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3b4bdd4..f22fed4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2016-03-15 Andrey Belevantsev <abel@ispras.ru> + + PR target/64411 + * sched-deps.c (get_implicit_reg_pending_clobbers): New function, + factored out from ... + (sched_analyze_insn): ... here. + * sched-int.h (get_implicit_reg_pending_clobbers): Declare it. + * sel-sched-ir.c (setup_id_implicit_regs): New function, use + get_implicit_reg_pending_clobbers in it. + (setup_id_reg_sets): Use setup_id_implicit_regs. + (deps_init_id): Ditto. + 2016-03-15 Tom de Vries <tom@codesourcery.com> PR ipa/70161 diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index 4961dfb..5cc8e63 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -2860,6 +2860,17 @@ sched_macro_fuse_insns (rtx_insn *insn) } +/* Get the implicit reg pending clobbers for INSN and save them in TEMP. */ +void +get_implicit_reg_pending_clobbers (HARD_REG_SET *temp, rtx_insn *insn) +{ + extract_insn (insn); + preprocess_constraints (insn); + alternative_mask preferred = get_preferred_alternatives (insn); + ira_implicitly_set_insn_hard_regs (temp, preferred); + AND_COMPL_HARD_REG_SET (*temp, ira_no_alloc_regs); +} + /* Analyze an INSN with pattern X to find all dependencies. */ static void sched_analyze_insn (struct deps_desc *deps, rtx x, rtx_insn *insn) @@ -2872,12 +2883,7 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx_insn *insn) if (! reload_completed) { HARD_REG_SET temp; - - extract_insn (insn); - preprocess_constraints (insn); - alternative_mask prefrred = get_preferred_alternatives (insn); - ira_implicitly_set_insn_hard_regs (&temp, prefrred); - AND_COMPL_HARD_REG_SET (temp, ira_no_alloc_regs); + get_implicit_reg_pending_clobbers (&temp, insn); IOR_HARD_REG_SET (implicit_reg_pending_clobbers, temp); } diff --git a/gcc/sched-int.h b/gcc/sched-int.h index 2a45703..de5d326 100644 --- a/gcc/sched-int.h +++ b/gcc/sched-int.h @@ -1351,6 +1351,7 @@ extern void finish_deps_global (void); extern void deps_analyze_insn (struct deps_desc *, rtx_insn *); extern void remove_from_deps (struct deps_desc *, rtx_insn *); extern void init_insn_reg_pressure_info (rtx_insn *); +extern void get_implicit_reg_pending_clobbers (HARD_REG_SET *, rtx_insn *); extern dw_t get_dep_weak (ds_t, ds_t); extern ds_t set_dep_weak (ds_t, ds_t, dw_t); diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index d6c86b8..5cb36df 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -2650,6 +2650,23 @@ maybe_downgrade_id_to_use (idata_t id, insn_t insn) IDATA_TYPE (id) = USE; } +/* Setup implicit register clobbers calculated by sched-deps for INSN + before reload and save them in ID. */ +static void +setup_id_implicit_regs (idata_t id, insn_t insn) +{ + if (reload_completed) + return; + + HARD_REG_SET temp; + unsigned regno; + hard_reg_set_iterator hrsi; + + get_implicit_reg_pending_clobbers (&temp, insn); + EXECUTE_IF_SET_IN_HARD_REG_SET (temp, 0, regno, hrsi) + SET_REGNO_REG_SET (IDATA_REG_SETS (id), regno); +} + /* Setup register sets describing INSN in ID. */ static void setup_id_reg_sets (idata_t id, insn_t insn) @@ -2704,6 +2721,9 @@ setup_id_reg_sets (idata_t id, insn_t insn) } } + /* Also get implicit reg clobbers from sched-deps. */ + setup_id_implicit_regs (id, insn); + return_regset_to_pool (tmp); } @@ -2735,20 +2755,18 @@ deps_init_id (idata_t id, insn_t insn, bool force_unique_p) deps_init_id_data.force_use_p = false; init_deps (dc, false); - memcpy (&deps_init_id_sched_deps_info, &const_deps_init_id_sched_deps_info, sizeof (deps_init_id_sched_deps_info)); - if (spec_info != NULL) deps_init_id_sched_deps_info.generate_spec_deps = 1; - sched_deps_info = &deps_init_id_sched_deps_info; deps_analyze_insn (dc, insn); + /* Implicit reg clobbers received from sched-deps separately. */ + setup_id_implicit_regs (id, insn); free_deps (dc); - deps_init_id_data.id = NULL; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c37e85..7b5fa63 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-03-15 Andrey Belevantsev <abel@ispras.ru> + + PR target/64411 + * gcc.target/i386/pr64411.C: New test. + 2016-03-15 Tom de Vries <tom@codesourcery.com> * gfortran.dg/goacc/kernels-alias-2.f95: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr64411.C b/gcc/testsuite/gcc.target/i386/pr64411.C new file mode 100644 index 0000000..55858fb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr64411.C @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -mcmodel=medium -fPIC -fschedule-insns -fselective-scheduling" } */ + +typedef __SIZE_TYPE__ size_t; + +extern "C" long strtol () + { return 0; } + +static struct { + void *sp[2]; +} info; + +union S813 +{ + void * c[5]; +} +s813; + +S813 a813[5]; +S813 check813 (S813, S813 *, S813); + +void checkx813 () +{ + __builtin_memset (&s813, '\0', sizeof (s813)); + __builtin_memset (&info, '\0', sizeof (info)); + check813 (s813, &a813[1], a813[2]); +} |