summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-04 21:35:49 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-04 21:35:49 +0000
commit388d1fc1a1e7f123e93c29a5b0147b53cc2500a9 (patch)
treef9c9a2643a9f3afe1404b5aff6758d8e8da39b9b /gcc/tree-ssa-dom.c
parent7eeec80a8752b6e562a00d9821a1552fe5e76164 (diff)
downloadgcc-388d1fc1a1e7f123e93c29a5b0147b53cc2500a9.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95903 138bc75d-0d04-0410-961f-82ee72b054a4
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 242de47b610..a14356500aa 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 ();