From: Jiong Wang Date: Thu, 25 Sep 2014 16:39:49 +0000 (+0000) Subject: Improve live-in calculation for splitted block X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d0d9aad78a3d64f1b0c5c7b7abcea05bc6bc82fd;p=gcc.git Improve live-in calculation for splitted block gcc/ * shrink-wrap.c (move_insn_for_shrink_wrap): Initialize the live-in of new created BB as the intersection of live-in from "old_dest" and live-out from "bb". gcc/testsuite/ * gcc.target/i386/shrink_wrap_1.c: New test. From-SVN: r215611 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3bf52a6801c..c3533ef2c15 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-09-25 Jiong Wang + + * shrink-wrap.c (move_insn_for_shrink_wrap): Initialize the live-in of + new created BB as the intersection of live-in from "old_dest" and + live-out from "bb". + 2014-09-25 Felix Yang * lra.c (lra_set_insn_recog_data): Fix typo in comment. diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c index af23f0288d7..bd4813c82ae 100644 --- a/gcc/shrink-wrap.c +++ b/gcc/shrink-wrap.c @@ -250,16 +250,21 @@ move_insn_for_shrink_wrap (basic_block bb, rtx_insn *insn, if (!df_live) return false; + basic_block old_dest = live_edge->dest; next_block = split_edge (live_edge); /* We create a new basic block. Call df_grow_bb_info to make sure all data structures are allocated. */ df_grow_bb_info (df_live); - bitmap_copy (df_get_live_in (next_block), df_get_live_out (bb)); + + bitmap_and (df_get_live_in (next_block), df_get_live_out (bb), + df_get_live_in (old_dest)); df_set_bb_dirty (next_block); /* We should not split more than once for a function. */ - gcc_assert (!(*split_p)); + if (*split_p) + return false; + *split_p = true; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fe01c672772..9c7c3c9169d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-09-25 Jiong Wang + + * gcc.target/i386/shrink_wrap_1.c: New test. + 2014-09-25 Bill Schmidt PR target/63335 diff --git a/gcc/testsuite/gcc.target/i386/shrink_wrap_1.c b/gcc/testsuite/gcc.target/i386/shrink_wrap_1.c new file mode 100644 index 00000000000..47f24681243 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/shrink_wrap_1.c @@ -0,0 +1,48 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-rtl-pro_and_epilogue" } */ + +enum machine_mode +{ + FAKE_0, + FAKE_1, + FAKE_2, + FAKE_3, + FAKE_4, + FAKE_5, + NUM_MACHINE_MODES, +}; + +typedef int *rtx; +typedef long unsigned int size_t; +extern unsigned char mode_size[NUM_MACHINE_MODES]; + +extern rtx c_readstr (const char *, enum machine_mode); +extern rtx convert_to_mode (enum machine_mode, rtx, int); +extern rtx expand_mult (enum machine_mode, rtx, rtx, rtx, int); +extern rtx force_reg (enum machine_mode, rtx); +extern void *memset (void *__s, int __c, size_t __n); + +rtx +builtin_memset_gen_str (void *data, long offset __attribute__ ((__unused__)), + enum machine_mode mode) +{ + rtx target, coeff; + size_t size; + char *p; + + size = ((unsigned short) (__builtin_constant_p (mode) + ? mode_size_inline (mode) : mode_size[mode])); + if (size == 1) + return (rtx) data; + + p = ((char *) __builtin_alloca(sizeof (char) * (size))); + memset (p, 1, size); + coeff = c_readstr (p, mode); + + target = convert_to_mode (mode, (rtx) data, 1); + target = expand_mult (mode, target, coeff, (rtx) 0, 1); + return force_reg (mode, target); +} + +/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" } } */ +/* { dg-final { cleanup-rtl-dump "pro_and_epilogue" } } */