summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog40
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/basic-block.h22
-rw-r--r--gcc/cfg.c144
-rw-r--r--gcc/cfghooks.c4
-rw-r--r--gcc/cfglayout.c26
-rw-r--r--gcc/cfgloopmanip.c25
-rw-r--r--gcc/dominance.c6
-rw-r--r--gcc/except.c1
-rw-r--r--gcc/loop-unroll.c16
-rw-r--r--gcc/loop-unswitch.c6
-rw-r--r--gcc/tree-cfg.c28
-rw-r--r--gcc/tree-ssa-loop-ivcanon.c3
-rw-r--r--gcc/tree-ssa-loop-manip.c4
-rw-r--r--gcc/tree-ssa-loop-unswitch.c2
15 files changed, 263 insertions, 66 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f0cbb568fa5..82fb8a6ca94 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,43 @@
+2005-06-16 Jan Hubicka <jh@suse.cz>
+
+ * Makefile.in (cfg.o): Add new dependencies.
+ * basic-block.h (reorder_block_def): Kill
+ original/copy/duplicated/copy_number fields.
+ (BB_DUPLICATED): New flag.
+ (initialize_original_copy_tables, free_original_copy_tables,
+ set_bb_original, get_bb_original, set_bb_copy, get_bb_copy): New.
+ * cfg.c: Include hashtab.h and alloc-pool.h
+ (bb_original, bb_copy, original_copy_bb_pool): New static vars.
+ (htab_bb_copy_original_entry): New struct.
+ (bb_copy_original_hash, bb_copy_original_eq): New static functions.
+ (initialize_original_copy_tables, free_original_copy_tables,
+ set_bb_original, get_bb_original, set_bb_copy, get_bb_copy): New
+ global functions.
+ * cfghooks.c (duplicate_block): Update original/copy handling.
+ * cfglayout.c (fixup_reorder_chain): Likewise.
+ (cfg_layout_initialize): Initialize orignal_copy tables.
+ (cfg_layout_finalize): FInalize original_copy tables.
+ (can_copy_bbs_p): Use BB_DUPLICATED flag.
+ (copy_bbs): Likewise.
+ * cfgloopmanip.c (update-single_exits_after_duplication): Likewise.
+ (duplicate_loop_to_header_edge): Likewise; update handling of
+ copy_number.
+ (loop_version): Likewise.
+ * dominance.c (get_dominated_by_region): Use BB_DUPLICATED_FLAG.
+ * except.c (expand_resx_expr): Check that reg->resume is not set.
+ * loop-unroll.c (unroll_loop_constant_iterations,
+ unroll_loop_runtime_iterations, apply_opt_in_copies): Update
+ copy/original handling.
+ * loop-unwitch.c (unswitch_loop): Likewise.
+ * tree-cfg.c (create_bb): Do not initialize RBI.
+ (disband_implicit_edges): Do not kill RBI.
+ (add_phi_args_after_copy_bb): Use new original/copy mapping.
+ (add_phi_args_after_copy): Use BB_DUPLICATED flag.
+ (tree_duplicate_sese_region): Update original/copy handling.
+ * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise.
+ * tree-ssa-loop-manip.c (copy_phi_node_args): Likewise.
+ * tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Likewise.
+
2005-06-15 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/21923
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 7a1ae761078..b54ddf36f60 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2180,7 +2180,7 @@ flow.o : flow.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(EXPR_H) $(TM_P_H) $(OBSTACK_H) $(SPLAY_TREE_H) $(TIMEVAR_H)
cfg.o : cfg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(FLAGS_H) \
$(REGS_H) hard-reg-set.h output.h toplev.h function.h except.h $(GGC_H) \
- $(TM_P_H) $(TIMEVAR_H) $(OBSTACK_H) $(TREE_H)
+ $(TM_P_H) $(TIMEVAR_H) $(OBSTACK_H) $(TREE_H) alloc-pool.h $(HASHTAB_H)
cfghooks.o: cfghooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TIMEVAR_H) toplev.h
cfgexpand.o : cfgexpand.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 2979e01a3ea..d9244d271fd 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -279,16 +279,6 @@ struct reorder_block_def GTY(())
basic_block next;
- /* These pointers may be unreliable as the first is only used for
- debugging (and should probably be removed, and the second is only
- used by copying. The basic blocks pointed to may be removed and
- that leaves these pointers pointing to garbage. */
- basic_block GTY ((skip (""))) original;
- basic_block GTY ((skip (""))) copy;
-
- int duplicated;
- int copy_number;
-
/* This field is used by the bb-reorder and tracer passes. */
int visited;
};
@@ -332,7 +322,10 @@ enum
BB_HOT_PARTITION = 64,
/* Set on blocks that should be put in a cold section. */
- BB_COLD_PARTITION = 128
+ BB_COLD_PARTITION = 128,
+
+ /* Set on block that was duplicated. */
+ BB_DUPLICATED = 256
};
/* Dummy flag for convenience in the hot/cold partitioning code. */
@@ -984,6 +977,13 @@ extern void break_superblocks (void);
extern void check_bb_profile (basic_block, FILE *);
extern void update_bb_profile_for_threading (basic_block, int, gcov_type, edge);
+extern void initialize_original_copy_tables (void);
+extern void free_original_copy_tables (void);
+extern void set_bb_original (basic_block, basic_block);
+extern basic_block get_bb_original (basic_block);
+extern void set_bb_copy (basic_block, basic_block);
+extern basic_block get_bb_copy (basic_block);
+
#include "cfghooks.h"
#endif /* GCC_BASIC_BLOCK_H */
diff --git a/gcc/cfg.c b/gcc/cfg.c
index e842a508346..f33a95061a0 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -63,6 +63,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "obstack.h"
#include "timevar.h"
#include "ggc.h"
+#include "hashtab.h"
+#include "alloc-pool.h"
/* The obstack on which the flow graph components are allocated. */
@@ -940,3 +942,145 @@ scale_bbs_frequencies_gcov_type (basic_block *bbs, int nbbs, gcov_type num,
e->count = (e->count * num) /den;
}
}
+
+/* Datastructures used to maintain mapping between basic blocks and copies. */
+static htab_t bb_original;
+static htab_t bb_copy;
+static alloc_pool original_copy_bb_pool;
+
+struct htab_bb_copy_original_entry
+{
+ /* Block we are attaching info to. */
+ int index1;
+ /* Index of original or copy (depending on the hashtable) */
+ int index2;
+};
+
+static hashval_t
+bb_copy_original_hash (const void *p)
+{
+ struct htab_bb_copy_original_entry *data
+ = ((struct htab_bb_copy_original_entry *)p);
+
+ return data->index1;
+}
+static int
+bb_copy_original_eq (const void *p, const void *q)
+{
+ struct htab_bb_copy_original_entry *data
+ = ((struct htab_bb_copy_original_entry *)p);
+ struct htab_bb_copy_original_entry *data2
+ = ((struct htab_bb_copy_original_entry *)q);
+
+ return data->index1 == data2->index1;
+}
+
+/* Initialize the datstructures to maintain mapping between blocks and it's copies. */
+void
+initialize_original_copy_tables (void)
+{
+ gcc_assert (!original_copy_bb_pool);
+ original_copy_bb_pool
+ = create_alloc_pool ("original_copy",
+ sizeof (struct htab_bb_copy_original_entry), 10);
+ bb_original = htab_create (10, bb_copy_original_hash,
+ bb_copy_original_eq, NULL);
+ bb_copy = htab_create (10, bb_copy_original_hash, bb_copy_original_eq, NULL);
+}
+
+/* Free the datstructures to maintain mapping between blocks and it's copies. */
+void
+free_original_copy_tables (void)
+{
+ gcc_assert (original_copy_bb_pool);
+ htab_delete (bb_copy);
+ htab_delete (bb_original);
+ free_alloc_pool (original_copy_bb_pool);
+ bb_copy = NULL;
+ bb_original = NULL;
+ original_copy_bb_pool = NULL;
+}
+
+/* Set original for basic block. Do nothing when datstructures are not
+ intialized so passes not needing this don't need to care. */
+void
+set_bb_original (basic_block bb, basic_block original)
+{
+ if (original_copy_bb_pool)
+ {
+ struct htab_bb_copy_original_entry **slot;
+ struct htab_bb_copy_original_entry key;
+
+ key.index1 = bb->index;
+ slot =
+ (struct htab_bb_copy_original_entry **) htab_find_slot (bb_original,
+ &key, INSERT);
+ if (*slot)
+ (*slot)->index2 = original->index;
+ else
+ {
+ *slot = pool_alloc (original_copy_bb_pool);
+ (*slot)->index1 = bb->index;
+ (*slot)->index2 = original->index;
+ }
+ }
+}
+
+/* Get the original basic block. */
+basic_block
+get_bb_original (basic_block bb)
+{
+ struct htab_bb_copy_original_entry *entry;
+ struct htab_bb_copy_original_entry key;
+
+ gcc_assert (original_copy_bb_pool);
+
+ key.index1 = bb->index;
+ entry = (struct htab_bb_copy_original_entry *) htab_find (bb_original, &key);
+ if (entry)
+ return BASIC_BLOCK (entry->index2);
+ else
+ return NULL;
+}
+
+/* Set copy for basic block. Do nothing when datstructures are not
+ intialized so passes not needing this don't need to care. */
+void
+set_bb_copy (basic_block bb, basic_block copy)
+{
+ if (original_copy_bb_pool)
+ {
+ struct htab_bb_copy_original_entry **slot;
+ struct htab_bb_copy_original_entry key;
+
+ key.index1 = bb->index;
+ slot =
+ (struct htab_bb_copy_original_entry **) htab_find_slot (bb_copy,
+ &key, INSERT);
+ if (*slot)
+ (*slot)->index2 = copy->index;
+ else
+ {
+ *slot = pool_alloc (original_copy_bb_pool);
+ (*slot)->index1 = bb->index;
+ (*slot)->index2 = copy->index;
+ }
+ }
+}
+
+/* Get the copy of basic block. */
+basic_block
+get_bb_copy (basic_block bb)
+{
+ struct htab_bb_copy_original_entry *entry;
+ struct htab_bb_copy_original_entry key;
+
+ gcc_assert (original_copy_bb_pool);
+
+ key.index1 = bb->index;
+ entry = (struct htab_bb_copy_original_entry *) htab_find (bb_copy, &key);
+ if (entry)
+ return BASIC_BLOCK (entry->index2);
+ else
+ return NULL;
+}
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 35e65a31c31..2af7c0612cb 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -756,8 +756,8 @@ duplicate_block (basic_block bb, edge e)
new_bb->frequency = bb->frequency;
}
- new_bb->rbi->original = bb;
- bb->rbi->copy = new_bb;
+ set_bb_original (new_bb, bb);
+ set_bb_copy (bb, new_bb);
return new_bb;
}
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 3a701001b8c..7cf0dcf2743 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -802,9 +802,9 @@ fixup_reorder_chain (void)
bb = bb->rbi->next, index++)
{
fprintf (dump_file, " %i ", index);
- if (bb->rbi->original)
+ if (get_bb_original (bb))
fprintf (dump_file, "duplicate of %i ",
- bb->rbi->original->index);
+ get_bb_original (bb)->index);
else if (forwarder_block_p (bb)
&& !LABEL_P (BB_HEAD (bb)))
fprintf (dump_file, "compensation ");
@@ -1100,6 +1100,8 @@ cfg_layout_initialize (unsigned int flags)
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
initialize_bb_rbi (bb);
+ initialize_original_copy_tables ();
+
cfg_layout_rtl_register_cfg_hooks ();
record_effective_endpoints ();
@@ -1166,6 +1168,8 @@ cfg_layout_finalize (void)
#ifdef ENABLE_CHECKING
verify_flow_info ();
#endif
+
+ free_original_copy_tables ();
}
/* Checks whether all N blocks in BBS array can be copied. */
@@ -1177,7 +1181,7 @@ can_copy_bbs_p (basic_block *bbs, unsigned n)
int ret = true;
for (i = 0; i < n; i++)
- bbs[i]->rbi->duplicated = 1;
+ bbs[i]->flags |= BB_DUPLICATED;
for (i = 0; i < n; i++)
{
@@ -1185,7 +1189,7 @@ can_copy_bbs_p (basic_block *bbs, unsigned n)
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bbs[i]->succs)
if ((e->flags & EDGE_ABNORMAL)
- && e->dest->rbi->duplicated)
+ && (e->dest->flags & BB_DUPLICATED))
{
ret = false;
goto end;
@@ -1200,7 +1204,7 @@ can_copy_bbs_p (basic_block *bbs, unsigned n)
end:
for (i = 0; i < n; i++)
- bbs[i]->rbi->duplicated = 0;
+ bbs[i]->flags &= ~BB_DUPLICATED;
return ret;
}
@@ -1235,7 +1239,7 @@ copy_bbs (basic_block *bbs, unsigned n, basic_block *new_bbs,
/* Duplicate. */
bb = bbs[i];
new_bb = new_bbs[i] = duplicate_block (bb, NULL);
- bb->rbi->duplicated = 1;
+ bb->flags |= BB_DUPLICATED;
/* Add to loop. */
add_bb_to_loop (new_bb, bb->loop_father->copy);
/* Possibly set header. */
@@ -1253,9 +1257,9 @@ copy_bbs (basic_block *bbs, unsigned n, basic_block *new_bbs,
new_bb = new_bbs[i];
dom_bb = get_immediate_dominator (CDI_DOMINATORS, bb);
- if (dom_bb->rbi->duplicated)
+ if (dom_bb->flags & BB_DUPLICATED)
{
- dom_bb = dom_bb->rbi->copy;
+ dom_bb = get_bb_copy (dom_bb);
set_immediate_dominator (CDI_DOMINATORS, new_bb, dom_bb);
}
}
@@ -1275,15 +1279,15 @@ copy_bbs (basic_block *bbs, unsigned n, basic_block *new_bbs,
if (edges[j] && edges[j]->src == bb && edges[j]->dest == e->dest)
new_edges[j] = e;
- if (!e->dest->rbi->duplicated)
+ if (!(e->dest->flags & BB_DUPLICATED))
continue;
- redirect_edge_and_branch_force (e, e->dest->rbi->copy);
+ redirect_edge_and_branch_force (e, get_bb_copy (e->dest));
}
}
/* Clear information about duplicates. */
for (i = 0; i < n; i++)
- bbs[i]->rbi->duplicated = 0;
+ bbs[i]->flags &= ~BB_DUPLICATED;
}
#include "gt-cfglayout.h"
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 0a369787ebf..9972378a790 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -813,19 +813,19 @@ update_single_exits_after_duplication (basic_block *bbs, unsigned nbbs,
unsigned i;
for (i = 0; i < nbbs; i++)
- bbs[i]->rbi->duplicated = 1;
+ bbs[i]->flags |= BB_DUPLICATED;
for (; loop->outer; loop = loop->outer)
{
if (!loop->single_exit)
continue;
- if (loop->single_exit->src->rbi->duplicated)
+ if (loop->single_exit->src->flags & BB_DUPLICATED)
loop->single_exit = NULL;
}
for (i = 0; i < nbbs; i++)
- bbs[i]->rbi->duplicated = 0;
+ bbs[i]->flags &= ~BB_DUPLICATED;
}
/* Duplicates body of LOOP to given edge E NDUPL times. Takes care of updating
@@ -983,13 +983,16 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, struct loops *loops,
copy_bbs (bbs, n, new_bbs, spec_edges, 2, new_spec_edges, loop);
for (i = 0; i < n; i++)
- new_bbs[i]->rbi->copy_number = j + 1;
+ {
+ gcc_assert (!new_bbs[i]->aux);
+ new_bbs[i]->aux = (void *)(size_t)(j + 1);
+ }
/* Note whether the blocks and edges belong to an irreducible loop. */
if (add_irreducible_flag)
{
for (i = 0; i < n; i++)
- new_bbs[i]->rbi->duplicated = 1;
+ new_bbs[i]->flags |= BB_DUPLICATED;
for (i = 0; i < n; i++)
{
edge_iterator ei;
@@ -998,13 +1001,13 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, struct loops *loops,
new_bb->flags |= BB_IRREDUCIBLE_LOOP;
FOR_EACH_EDGE (ae, ei, new_bb->succs)
- if (ae->dest->rbi->duplicated
+ if ((ae->dest->flags & BB_DUPLICATED)
&& (ae->src->loop_father == target
|| ae->dest->loop_father == target))
ae->flags |= EDGE_IRREDUCIBLE_LOOP;
}
for (i = 0; i < n; i++)
- new_bbs[i]->rbi->duplicated = 0;
+ new_bbs[i]->flags &= ~BB_DUPLICATED;
}
/* Redirect the special edges. */
@@ -1064,7 +1067,7 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, struct loops *loops,
int n_dom_bbs,j;
bb = bbs[i];
- bb->rbi->copy_number = 0;
+ bb->aux = 0;
n_dom_bbs = get_dominated_by (CDI_DOMINATORS, bb, &dom_bbs);
for (j = 0; j < n_dom_bbs; j++)
@@ -1447,18 +1450,18 @@ loop_version (struct loops *loops, struct loop * loop,
return NULL;
}
- latch_edge = single_succ_edge (loop->latch->rbi->copy);
+ latch_edge = single_succ_edge (get_bb_copy (loop->latch));
extract_cond_bb_edges (*condition_bb, &true_edge, &false_edge);
nloop = loopify (loops,
latch_edge,
- single_pred_edge (loop->header->rbi->copy),
+ single_pred_edge (get_bb_copy (loop->header)),
*condition_bb, true_edge, false_edge,
false /* Do not redirect all edges. */);
exit = loop->single_exit;
if (exit)
- nloop->single_exit = find_edge (exit->src->rbi->copy, exit->dest);
+ nloop->single_exit = find_edge (get_bb_copy (exit->src), exit->dest);
/* loopify redirected latch_edge. Update its PENDING_STMTS. */
lv_flush_pending_stmts (latch_edge);
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 00e3495d923..1018d1ae30e 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -746,15 +746,15 @@ get_dominated_by_region (enum cdi_direction dir, basic_block *region,
basic_block dom;
for (i = 0; i < n_region; i++)
- region[i]->rbi->duplicated = 1;
+ region[i]->flags |= BB_DUPLICATED;
for (i = 0; i < n_region; i++)
for (dom = first_dom_son (dir, region[i]);
dom;
dom = next_dom_son (dir, dom))
- if (!dom->rbi->duplicated)
+ if (!(dom->flags & BB_DUPLICATED))
doms[n_doms++] = dom;
for (i = 0; i < n_region; i++)
- region[i]->rbi->duplicated = 0;
+ region[i]->flags &= ~BB_DUPLICATED;
return n_doms;
}
diff --git a/gcc/except.c b/gcc/except.c
index c10fc883df7..e78341110d9 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -562,6 +562,7 @@ expand_resx_expr (tree exp)
int region_nr = TREE_INT_CST_LOW (TREE_OPERAND (exp, 0));
struct eh_region *reg = cfun->eh->region_array[region_nr];
+ gcc_assert (!reg->resume);
reg->resume = emit_jump_insn (gen_rtx_RESX (VOIDmode, region_nr));
emit_barrier ();
}
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 68512d02a5a..72fda46e391 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -790,7 +790,7 @@ unroll_loop_constant_iterations (struct loops *loops, struct loop *loop)
if (exit_at_end)
{
- basic_block exit_block = desc->in_edge->src->rbi->copy;
+ basic_block exit_block = get_bb_copy (desc->in_edge->src);
/* Find a new in and out edge; they are in the last copy we have made. */
if (EDGE_SUCC (exit_block, 0)->dest == desc->out_edge->dest)
@@ -1110,7 +1110,7 @@ unroll_loop_runtime_iterations (struct loops *loops, struct loop *loop)
if (exit_at_end)
{
- basic_block exit_block = desc->in_edge->src->rbi->copy;
+ basic_block exit_block = get_bb_copy (desc->in_edge->src);
/* Find a new in and out edge; they are in the last copy we have
made. */
@@ -2058,9 +2058,11 @@ apply_opt_in_copies (struct opt_info *opt_info,
for (i = opt_info->first_new_block; i < (unsigned) last_basic_block; i++)
{
bb = BASIC_BLOCK (i);
- orig_bb = bb->rbi->original;
+ orig_bb = get_bb_original (bb);
- delta = determine_split_iv_delta (bb->rbi->copy_number, n_copies,
+ /* bb->aux holds position in copy sequence initialized by
+ duplicate_loop_to_header_edge. */
+ delta = determine_split_iv_delta ((size_t)bb->aux, n_copies,
unrolling);
orig_insn = BB_HEAD (orig_bb);
for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); insn = next)
@@ -2124,12 +2126,12 @@ apply_opt_in_copies (struct opt_info *opt_info,
/* Rewrite also the original loop body. Find them as originals of the blocks
in the last copied iteration, i.e. those that have
- bb->rbi->original->copy == bb. */
+ get_bb_copy (get_bb_original (bb)) == bb. */
for (i = opt_info->first_new_block; i < (unsigned) last_basic_block; i++)
{
bb = BASIC_BLOCK (i);
- orig_bb = bb->rbi->original;
- if (orig_bb->rbi->copy != bb)
+ orig_bb = get_bb_original (bb);
+ if (get_bb_copy (orig_bb) != bb)
continue;
delta = determine_split_iv_delta (0, n_copies, unrolling);
diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c
index ef4e5b8c2d4..27a8bca2625 100644
--- a/gcc/loop-unswitch.c
+++ b/gcc/loop-unswitch.c
@@ -431,10 +431,10 @@ unswitch_loop (struct loops *loops, struct loop *loop, basic_block unswitch_on,
entry->flags |= irred_flag;
/* Record the block with condition we unswitch on. */
- unswitch_on_alt = unswitch_on->rbi->copy;
+ unswitch_on_alt = get_bb_copy (unswitch_on);
true_edge = BRANCH_EDGE (unswitch_on_alt);
false_edge = FALLTHRU_EDGE (unswitch_on);
- latch_edge = single_succ_edge (loop->latch->rbi->copy);
+ latch_edge = single_succ_edge (get_bb_copy (loop->latch));
/* Create a block with the condition. */
prob = true_edge->probability;
@@ -465,7 +465,7 @@ unswitch_loop (struct loops *loops, struct loop *loop, basic_block unswitch_on,
/* Loopify from the copy of LOOP body, constructing the new loop. */
nloop = loopify (loops, latch_edge,
- single_pred_edge (loop->header->rbi->copy), switch_bb,
+ single_pred_edge (get_bb_copy (loop->header)), switch_bb,
BRANCH_EDGE (switch_bb), FALLTHRU_EDGE (switch_bb), true);
/* Remove branches that are now unreachable in new loops. */
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 6108dd87622..6a72250e328 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -390,7 +390,6 @@ create_bb (void *h, void *e, basic_block after)
n_basic_blocks++;
last_basic_block++;
- initialize_bb_rbi (bb);
return bb;
}
@@ -2569,11 +2568,7 @@ disband_implicit_edges (void)
void
delete_tree_cfg_annotations (void)
{
- basic_block bb;
-
label_to_block_map = NULL;
- FOR_EACH_BB (bb)
- bb->rbi = NULL;
}
@@ -4161,7 +4156,7 @@ tree_duplicate_bb (basic_block bb)
/* Basic block BB_COPY was created by code duplication. Add phi node
arguments for edges going out of BB_COPY. The blocks that were
- duplicated have rbi->duplicated set to one. */
+ duplicated have BB_DUPLICATED set. */
void
add_phi_args_after_copy_bb (basic_block bb_copy)
@@ -4171,15 +4166,15 @@ add_phi_args_after_copy_bb (basic_block bb_copy)
edge_iterator ei;
tree phi, phi_copy, phi_next, def;
- bb = bb_copy->rbi->original;
+ bb = get_bb_original (bb_copy);
FOR_EACH_EDGE (e_copy, ei, bb_copy->succs)
{
if (!phi_nodes (e_copy->dest))
continue;
- if (e_copy->dest->rbi->duplicated)
- dest = e_copy->dest->rbi->original;
+ if (e_copy->dest->flags & BB_DUPLICATED)
+ dest = get_bb_original (e_copy->dest);
else
dest = e_copy->dest;
@@ -4190,8 +4185,8 @@ add_phi_args_after_copy_bb (basic_block bb_copy)
In this case we are not looking for edge to dest, but to
duplicated block whose original was dest. */
FOR_EACH_EDGE (e, ei, bb->succs)
- if (e->dest->rbi->duplicated
- && e->dest->rbi->original == dest)
+ if ((e->dest->flags & BB_DUPLICATED)
+ && get_bb_original (e->dest) == dest)
break;
gcc_assert (e != NULL);
@@ -4218,13 +4213,13 @@ add_phi_args_after_copy (basic_block *region_copy, unsigned n_region)
unsigned i;
for (i = 0; i < n_region; i++)
- region_copy[i]->rbi->duplicated = 1;
+ region_copy[i]->flags |= BB_DUPLICATED;
for (i = 0; i < n_region; i++)
add_phi_args_after_copy_bb (region_copy[i]);
for (i = 0; i < n_region; i++)
- region_copy[i]->rbi->duplicated = 0;
+ region_copy[i]->flags &= ~BB_DUPLICATED;
}
/* Duplicates a REGION (set of N_REGION basic blocks) with just a single
@@ -4298,6 +4293,8 @@ tree_duplicate_sese_region (edge entry, edge exit,
/* Record blocks outside the region that are dominated by something
inside. */
doms = xmalloc (sizeof (basic_block) * n_basic_blocks);
+ initialize_original_copy_tables ();
+
n_doms = get_dominated_by_region (CDI_DOMINATORS, region, n_region, doms);
total_freq = entry->dest->frequency;
@@ -4321,7 +4318,7 @@ tree_duplicate_sese_region (edge entry, edge exit,
}
/* Redirect the entry and add the phi node arguments. */
- redirected = redirect_edge_and_branch (entry, entry->dest->rbi->copy);
+ redirected = redirect_edge_and_branch (entry, get_bb_copy (entry->dest));
gcc_assert (redirected != NULL);
flush_pending_stmts (entry);
@@ -4330,7 +4327,7 @@ tree_duplicate_sese_region (edge entry, edge exit,
region, but was dominated by something inside needs recounting as
well. */
set_immediate_dominator (CDI_DOMINATORS, entry->dest, entry->src);
- doms[n_doms++] = entry->dest->rbi->original;
+ doms[n_doms++] = get_bb_original (entry->dest);
iterate_fix_dominators (CDI_DOMINATORS, doms, n_doms);
free (doms);
@@ -4343,6 +4340,7 @@ tree_duplicate_sese_region (edge entry, edge exit,
if (free_region_copy)
free (region_copy);
+ free_original_copy_tables ();
return true;
}
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 80aecdc2c3a..c38c2f2b007 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -226,6 +226,7 @@ try_unroll_loop_completely (struct loops *loops ATTRIBUTE_UNUSED,
old_cond = COND_EXPR_COND (cond);
COND_EXPR_COND (cond) = dont_exit;
update_stmt (cond);
+ initialize_original_copy_tables ();
if (!tree_duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop),
loops, n_unroll, NULL,
@@ -233,8 +234,10 @@ try_unroll_loop_completely (struct loops *loops ATTRIBUTE_UNUSED,
{
COND_EXPR_COND (cond) = old_cond;
update_stmt (cond);
+ free_original_copy_tables ();
return false;
}
+ free_original_copy_tables ();
}
COND_EXPR_COND (cond) = do_exit;
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index ff8f8998604..50989710dc4 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -566,13 +566,13 @@ copy_phi_node_args (unsigned first_new_block)
unsigned i;
for (i = first_new_block; i < (unsigned) last_basic_block; i++)
- BASIC_BLOCK (i)->rbi->duplicated = 1;
+ BASIC_BLOCK (i)->flags |= BB_DUPLICATED;
for (i = first_new_block; i < (unsigned) last_basic_block; i++)
add_phi_args_after_copy_bb (BASIC_BLOCK (i));
for (i = first_new_block; i < (unsigned) last_basic_block; i++)
- BASIC_BLOCK (i)->rbi->duplicated = 0;
+ BASIC_BLOCK (i)->flags &= ~BB_DUPLICATED;
}
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index cb235f0a4e5..21dc6b5f9ff 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -249,6 +249,7 @@ tree_unswitch_single_loop (struct loops *loops, struct loop *loop, int num)
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, ";; Unswitching loop\n");
+ initialize_original_copy_tables ();
/* Unswitch the loop on this condition. */
nloop = tree_unswitch_loop (loops, loop, bbs[i], cond);
if (!nloop)
@@ -256,6 +257,7 @@ tree_unswitch_single_loop (struct loops *loops, struct loop *loop, int num)
/* Update the SSA form after unswitching. */
update_ssa (TODO_update_ssa);
+ free_original_copy_tables ();
/* Invoke itself on modified loops. */
tree_unswitch_single_loop (loops, nloop, num + 1);