aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2005-03-04 14:35:49 -0700
committerJeff Law <law@gcc.gnu.org>2005-03-04 14:35:49 -0700
commitd38ffc55428bbe33b33d8b14693e69cd1b63c820 (patch)
treef9c9a2643a9f3afe1404b5aff6758d8e8da39b9b /gcc/tree-ssa-dom.c
parent3852e8b8f21397fc719ef45ba404a58bed53a7d0 (diff)
downloadgcc-d38ffc55428bbe33b33d8b14693e69cd1b63c820.zip
gcc-d38ffc55428bbe33b33d8b14693e69cd1b63c820.tar.gz
gcc-d38ffc55428bbe33b33d8b14693e69cd1b63c820.tar.bz2
basic-block.h (rediscover_loops_after_threading): Declare.
* basic-block.h (rediscover_loops_after_threading): Declare. * tree-ssa-dom.c: Include cfgloop.h. (tree_ssa_dominator_optimize): Discover loops and some basic properties. Remove forwarder blocks recreated by loop header canonicalization. Also mark backedges in the CFG. * tree-ssa-threadupdate.c: Include cfgloop.h (rediscover_loops_after_threading): Define. (struct local_info): New field, JUMP_THREADED. (prune_undesirable_thread_requests): New function. (redirect_edges): Clear EDGE_ABNORMAL. If edges were threaded then record that fact for the callers of redirct_edges. (thread_block): If BB has incoming backedges, then call prune_undesirable_thraed_requests. Note when we are going to have to rediscover loop information. Return a boolean indicating if any jumps were threaded. (thread_through_all_blocks): Bubble up boolean indicating if any jumps were threaded. * Makefile.in (tree-ssa-dom.o): Depend on cfgloop.h (tree-ssa-threadupdate.o): Similarly. From-SVN: r95903
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 242de47..a143565 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -29,6 +29,7 @@ Boston, MA 02111-1307, USA. */
#include "tm_p.h"
#include "ggc.h"
#include "basic-block.h"
+#include "cfgloop.h"
#include "output.h"
#include "errors.h"
#include "expr.h"
@@ -368,6 +369,7 @@ tree_ssa_dominator_optimize (void)
{
struct dom_walk_data walk_data;
unsigned int i;
+ struct loops loops_info;
memset (&opt_stats, 0, sizeof (opt_stats));
@@ -407,6 +409,17 @@ tree_ssa_dominator_optimize (void)
calculate_dominance_info (CDI_DOMINATORS);
+ /* We need to know which edges exit loops so that we can
+ aggressively thread through loop headers to an exit
+ edge. */
+ flow_loops_find (&loops_info);
+ mark_loop_exit_edges (&loops_info);
+ flow_loops_free (&loops_info);
+
+ /* Clean up the CFG so that any forwarder blocks created by loop
+ canonicalization are removed. */
+ cleanup_tree_cfg ();
+
/* If we prove certain blocks are unreachable, then we want to
repeat the dominator optimization process as PHI nodes may
have turned into copies which allows better propagation of
@@ -417,6 +430,10 @@ tree_ssa_dominator_optimize (void)
/* Optimize the dominator tree. */
cfg_altered = false;
+ /* We need accurate information regarding back edges in the CFG
+ for jump threading. */
+ mark_dfs_back_edges ();
+
/* Recursively walk the dominator tree optimizing statements. */
walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
@@ -445,8 +462,24 @@ tree_ssa_dominator_optimize (void)
}
if (cfg_altered)
- free_dominance_info (CDI_DOMINATORS);
+ free_dominance_info (CDI_DOMINATORS);
+
cfg_altered |= cleanup_tree_cfg ();
+
+ if (rediscover_loops_after_threading)
+ {
+ /* Rerun basic loop analysis to discover any newly
+ created loops and update the set of exit edges. */
+ rediscover_loops_after_threading = false;
+ flow_loops_find (&loops_info);
+ mark_loop_exit_edges (&loops_info);
+ flow_loops_free (&loops_info);
+
+ /* Remove any forwarder blocks inserted by loop
+ header canonicalization. */
+ cleanup_tree_cfg ();
+ }
+
calculate_dominance_info (CDI_DOMINATORS);
rewrite_ssa_into_ssa ();