shrink-wrap.h: #define SHRINK_WRAPPING_ENABLED.
authorZhenqiang Chen <zhenqiang.chen@arm.com>
Tue, 9 Sep 2014 05:30:36 +0000 (05:30 +0000)
committerZhenqiang Chen <zqchen@gcc.gnu.org>
Tue, 9 Sep 2014 05:30:36 +0000 (05:30 +0000)
ChangeLog:
2014-09-09  Zhenqiang Chen  <zhenqiang.chen@arm.com>

* shrink-wrap.h: #define SHRINK_WRAPPING_ENABLED.
* ira.c: #include "shrink-wrap.h"
(split_live_ranges_for_shrink_wrap): Use SHRINK_WRAPPING_ENABLED.
* ifcvt.c: #include "shrink-wrap.h"
(dead_or_predicable): Use SHRINK_WRAPPING_ENABLED.

testsuite/ChangeLog:
2014-09-09  Zhenqiang Chen  <zhenqiang.chen@arm.com>

* gcc.target/arm/split-live-ranges-for-shrink-wrap.c: New test.

From-SVN: r215041

gcc/ChangeLog
gcc/ifcvt.c
gcc/ira.c
gcc/shrink-wrap.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/split-live-ranges-for-shrink-wrap.c [new file with mode: 0644]

index 44caf78578f7534188116cbd2a821ce10477a1db..3248a84be8f08d767635d0080ae14fc9073c613f 100644 (file)
@@ -1,3 +1,11 @@
+2014-09-09  Zhenqiang Chen  <zhenqiang.chen@arm.com>
+
+       * shrink-wrap.h: #define SHRINK_WRAPPING_ENABLED.
+       * ira.c: #include "shrink-wrap.h"
+       (split_live_ranges_for_shrink_wrap): Use SHRINK_WRAPPING_ENABLED.
+       * ifcvt.c: #include "shrink-wrap.h"
+       (dead_or_predicable): Use SHRINK_WRAPPING_ENABLED.
+
 2014-09-08  Trevor Saunders  <tsaunders@mozilla.com>
 
        * common/config/picochip/picochip-common.c: Remove.
index bce9fb3f0fedb604312cb6c438e495bc62a9f1bf..ed30a599ed673348ca76b94c8c022d3e6f2449cc 100644 (file)
@@ -42,6 +42,7 @@
 #include "df.h"
 #include "vec.h"
 #include "dbgcnt.h"
+#include "shrink-wrap.h"
 
 #ifndef HAVE_conditional_move
 #define HAVE_conditional_move 0
@@ -4288,14 +4289,13 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb,
        if (NONDEBUG_INSN_P (insn))
          df_simulate_find_defs (insn, merge_set);
 
-#ifdef HAVE_simple_return
       /* If shrink-wrapping, disable this optimization when test_bb is
         the first basic block and merge_bb exits.  The idea is to not
         move code setting up a return register as that may clobber a
         register used to pass function parameters, which then must be
         saved in caller-saved regs.  A caller-saved reg requires the
         prologue, killing a shrink-wrap opportunity.  */
-      if ((flag_shrink_wrap && HAVE_simple_return && !epilogue_completed)
+      if ((SHRINK_WRAPPING_ENABLED && !epilogue_completed)
          && ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb == test_bb
          && single_succ_p (new_dest)
          && single_succ (new_dest) == EXIT_BLOCK_PTR_FOR_FN (cfun)
@@ -4342,7 +4342,6 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb,
            }
          BITMAP_FREE (return_regs);
        }
-#endif
     }
 
  no_body:
index a48368ccced2d13f3e7b27f3267757103e290781..757819ded343cd50b4b03340db6004baa01dc89f 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -393,6 +393,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "dce.h"
 #include "dbgcnt.h"
 #include "rtl-iter.h"
+#include "shrink-wrap.h"
 
 struct target_ira default_target_ira;
 struct target_ira_int default_target_ira_int;
@@ -4780,7 +4781,7 @@ split_live_ranges_for_shrink_wrap (void)
   bitmap_head need_new, reachable;
   vec<basic_block> queue;
 
-  if (!flag_shrink_wrap)
+  if (!SHRINK_WRAPPING_ENABLED)
     return false;
 
   bitmap_initialize (&need_new, 0);
index 29bdcfd4ef23313d96c9d205ade9be9646c69802..7b8031aab5d2e3d289daeea0746fae268c99d5fe 100644 (file)
@@ -47,6 +47,9 @@ extern void convert_to_simple_return (edge entry_edge, edge orig_entry_edge,
                                      bitmap_head bb_flags,
                                      rtx_insn *returnjump,
                                      vec<edge> unconverted_simple_returns);
+#define SHRINK_WRAPPING_ENABLED (flag_shrink_wrap && HAVE_simple_return)
+#else
+#define SHRINK_WRAPPING_ENABLED false
 #endif
 
 #endif  /* GCC_SHRINK_WRAP_H  */
index cce4f264bde892dd09c3fe0483d47ca0c6e1b889..a53d96585921e53dd2113a77b9e4b414d973c3aa 100644 (file)
@@ -1,3 +1,7 @@
+2014-09-09  Zhenqiang Chen  <zhenqiang.chen@arm.com>
+
+       * gcc.target/arm/split-live-ranges-for-shrink-wrap.c: New test.
+
 2014-09-08  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/60196
diff --git a/gcc/testsuite/gcc.target/arm/split-live-ranges-for-shrink-wrap.c b/gcc/testsuite/gcc.target/arm/split-live-ranges-for-shrink-wrap.c
new file mode 100644 (file)
index 0000000..e36000b
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do assemble } */
+/* { dg-options "-mthumb -Os -fdump-rtl-ira " }  */
+/* { dg-require-effective-target arm_thumb1_ok } */
+
+int foo (char *, char *, int);
+int test (int d, char * out, char *in, int len)
+{
+  if (out != in)
+    foo (out, in, len);
+  return 0;
+}
+/* { dg-final { object-size text <= 20 } } */
+/* { dg-final { scan-rtl-dump-not "Split live-range of register" "ira" } } */
+/* { dg-final { cleanup-rtl-dump "ira" } } */