aboutsummaryrefslogtreecommitdiff
path: root/gcc/tracer.c
diff options
context:
space:
mode:
authorAjit Agarwal <ajitkum@xilinx.com>2015-11-13 23:31:51 +0000
committerJeff Law <law@gcc.gnu.org>2015-11-13 16:31:51 -0700
commit8fe17e23b052741c8cbec99c7173c3c07f8e8c64 (patch)
tree5b2631fd0e6dc942bbd89ba9465f3c9d6d96aaa6 /gcc/tracer.c
parent269e63b735d6e4e18367e94e8417b5d5eb799960 (diff)
downloadgcc-8fe17e23b052741c8cbec99c7173c3c07f8e8c64.zip
gcc-8fe17e23b052741c8cbec99c7173c3c07f8e8c64.tar.gz
gcc-8fe17e23b052741c8cbec99c7173c3c07f8e8c64.tar.bz2
[Patch,tree-optimization]: Add new path Splitting pass on tree ssa
representation * Makefile.in (OBJS): Add gimple-ssa-split-paths.o * common.opt (-fsplit-paths): New flag controlling path splitting. * doc/invoke.texi (fsplit-paths): Document. * opts.c (default_options_table): Add -fsplit-paths to -O2. * passes.def: Add split_paths pass. * timevar.def (TV_SPLIT_PATHS): New timevar. * tracer.c: Include "tracer.h" (ignore_bb_p): No longer static. (transform_duplicate): New function, broken out of tail_duplicate. (tail_duplicate): Use transform_duplicate. * tracer.h (ignore_bb_p): Declare (transform_duplicate): Likewise. * tree-pass.h (make_pass_split_paths): Declare. * gimple-ssa-split-paths.c: New file. * gcc.dg/tree-ssa/split-path-1.c: New test. Co-Authored-By: Jeff Law <law@redhat.com> From-SVN: r230364
Diffstat (limited to 'gcc/tracer.c')
-rw-r--r--gcc/tracer.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/gcc/tracer.c b/gcc/tracer.c
index 941dc20..c2dba4c 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -51,9 +51,9 @@
#include "tree-inline.h"
#include "cfgloop.h"
#include "fibonacci_heap.h"
+#include "tracer.h"
static int count_insns (basic_block);
-static bool ignore_bb_p (const_basic_block);
static bool better_p (const_edge, const_edge);
static edge find_best_successor (basic_block);
static edge find_best_predecessor (basic_block);
@@ -85,7 +85,7 @@ bb_seen_p (basic_block bb)
}
/* Return true if we should ignore the basic block for purposes of tracing. */
-static bool
+bool
ignore_bb_p (const_basic_block bb)
{
if (bb->index < NUM_FIXED_BLOCKS)
@@ -226,6 +226,24 @@ find_trace (basic_block bb, basic_block *trace)
return i;
}
+/* Duplicate block BB2, placing it after BB in the CFG. Return the
+ newly created block. */
+basic_block
+transform_duplicate (basic_block bb, basic_block bb2)
+{
+ edge e;
+ basic_block copy;
+
+ e = find_edge (bb, bb2);
+
+ copy = duplicate_block (bb2, e, bb);
+ flush_pending_stmts (e);
+
+ add_phi_args_after_copy (&copy, 1, NULL);
+
+ return (copy);
+}
+
/* Look for basic blocks in frequency order, construct traces and tail duplicate
if profitable. */
@@ -321,17 +339,8 @@ tail_duplicate (void)
entries or at least rotate the loop. */
&& bb2->loop_father->header != bb2)
{
- edge e;
- basic_block copy;
-
nduplicated += counts [bb2->index];
-
- e = find_edge (bb, bb2);
-
- copy = duplicate_block (bb2, e, bb);
- flush_pending_stmts (e);
-
- add_phi_args_after_copy (&copy, 1, NULL);
+ basic_block copy = transform_duplicate (bb, bb2);
/* Reconsider the original copy of block we've duplicated.
Removing the most common predecessor may make it to be