This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa-cfg] BIND_EXPR removal
Hello,
> >>>nope, both problems I have detected should also be on mainline. The
> >>>first is the dom_children allocated by gc (this I fixed). The second
> >>>one is that dominance_info structure contains varray that is also
> >>>allocated by gc. Both of these cause problems when dominators are
> >>>recomputed,
> >>
> >>I should also note that once Andrew fixes the remaining critical edge
> >>splitting bugs, so i can pre-split critical edges in PRE, we won't be
> >>needing to recompute dominators anymore in SSAPRE, so the problem goes
> >>away.
> >
> >what are these problems?
>
> Fun with splitting edges that belong to switch statements and whatnot.
> See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12529 for the latest
> one.
>
>
> Or, try changing the #if 0 in split_critical_edges in tree-ssa-pre.c to
> #if 1, and see if it bootstraps.
OK, testing the attached patch.
Zdenek
Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-pre.c,v
retrieving revision 1.1.4.71.2.3
diff -c -3 -p -r1.1.4.71.2.3 tree-ssa-pre.c
*** tree-ssa-pre.c 6 Oct 2003 23:33:56 -0000 1.1.4.71.2.3
--- tree-ssa-pre.c 7 Oct 2003 18:01:58 -0000
*************** static tree create_expr_ref (struct expr
*** 230,236 ****
static inline bool ephi_will_be_avail (tree);
static inline tree ephi_at_block (basic_block);
static tree get_default_def (tree, htab_t);
- static void handle_bb_creation (edge, edge);
static inline bool same_e_version_real_occ_real_occ (struct expr_info *,
const tree,
const tree);
--- 230,235 ----
*************** static bitmap *pre_dfs;
*** 266,274 ****
static int class_count;
static int preorder_count;
- /* Whether we need to recompute dominators due to basic block changes. */
- static bool redo_dominators = false;
-
/* Iterated dominance frontiers cache. */
static bitmap *idfs_cache;
--- 265,270 ----
*************** reaching_def (tree var, tree currstmt, b
*** 1676,1715 ****
return reaching_def (var, currstmt, dom, ignore);
}
- /* Handle creation of a new basic block as a result of edge insertion. */
- static void
- handle_bb_creation (edge old_edge, edge new_edge)
- {
- unsigned int i;
- bb_ann_t ann;
- basic_block bb;
- FOR_EACH_BB (bb)
- {
- ann = bb_ann (bb);
- if (ann->erefs)
- for (i = 0; i < VARRAY_SIZE (ann->erefs); i++)
- {
- tree tempephi = VARRAY_TREE (ann->erefs, i);
- if (tempephi == NULL) continue;
- if (TREE_CODE (tempephi) == EPHI_NODE)
- {
- tree phi = EREF_TEMP (tempephi);
- int num_elem = PHI_NUM_ARGS (phi);
- int j;
- for (j = 0; j < num_elem; j++)
- if (PHI_ARG_EDGE (phi, j) == old_edge)
- PHI_ARG_EDGE (phi, j) = new_edge;
-
- num_elem = EPHI_NUM_ARGS (tempephi);
- for (j = 0; j < num_elem; j++)
- if (EPHI_ARG_EDGE (tempephi, j) == old_edge)
- EPHI_ARG_EDGE (tempephi, j) = new_edge;
-
- }
- }
- }
- }
-
/* Insert one ephi operand that doesn't currently exist as a use. */
static void
insert_one_operand (struct expr_info *ei, tree ephi, int opnd_indx,
--- 1672,1677 ----
*************** insert_one_operand (struct expr_info *ei
*** 1812,1833 ****
bsi_insert_on_edge_immediate (e, expr, &bsi,
&createdbb);
if (createdbb != NULL)
! {
! set_bb_for_stmt (x, createdbb);
! if (createdbb->succ && createdbb->succ->succ_next)
! abort ();
! handle_bb_creation (e, createdbb->succ);
! /* If we split the block, we need to update
! the euse, the ephi edge, etc. */
! /* Cheat for now, don't redo the dominance info,
! it shouldn't matter until after insertion
! is done for this expression.*/
! /* bb = bb_for_stmt (expr); */
! set_bb_for_stmt (x, createdbb);
!
! /* e->src = createdbb; */
! redo_dominators = true;
! }
break;
}
}
--- 1774,1780 ----
bsi_insert_on_edge_immediate (e, expr, &bsi,
&createdbb);
if (createdbb != NULL)
! abort ();
break;
}
}
*************** pre_expression (struct expr_info *slot,
*** 2865,2890 ****
static void
split_critical_edges (void)
{
- #if 0
struct edge_list *el = create_edge_list ();
int i;
edge e;
- for (i = 0; i < NUM_EDGES (el); i++)
- {
- e = INDEX_EDGE (el, i);
- if (EDGE_CRITICAL_P (e) && !(e->flags & EDGE_ABNORMAL))
- {
- tree label = build1 (LABEL_EXPR, void_type_node, NULL_TREE);
- LABEL_EXPR_LABEL (label) = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
- DECL_ARTIFICIAL (LABEL_EXPR_LABEL (label)) = 1;
- DECL_CONTEXT (LABEL_EXPR_LABEL (label)) = current_function_decl;
! bsi_insert_on_edge (e, label);
! }
! }
! bsi_commit_edge_inserts (0, NULL);
free_edge_list (el);
- #endif
}
/* Main entry point to the SSA-PRE pass.
--- 2812,2828 ----
static void
split_critical_edges (void)
{
struct edge_list *el = create_edge_list ();
int i;
edge e;
! for (i = 0; i < NUM_EDGES (el); i++)
! {
! e = INDEX_EDGE (el, i);
! if (EDGE_CRITICAL_P (e) && !(e->flags & EDGE_ABNORMAL))
! split_edge (e);
! }
free_edge_list (el);
}
/* Main entry point to the SSA-PRE pass.
*************** tree_perform_ssapre (tree fndecl, enum t
*** 3001,3030 ****
htab_delete (ephi_pindex_htab);
ephi_pindex_htab = NULL;
}
! /* ggc_collect (); */ /* This causes whole lot of trouble with temporary structures. */
! if (redo_dominators)
! {
! redo_dominators = false;
!
! free_dominance_info (pre_idom);
! for (i = 0; i < currbbs; i++)
! BITMAP_XFREE (pre_dfs[i]);
! free (pre_dfs);
! for (i = 0; i < currbbs; i++)
! if (idfs_cache[i] != NULL)
! BITMAP_XFREE (idfs_cache[i]);
! /* Recompute immediate dominators. */
! pre_idom = calculate_dominance_info (CDI_DOMINATORS);
! build_dominator_tree (pre_idom);
! currbbs = n_basic_blocks;
!
! /* Reompute dominance frontiers. */
! pre_dfs = (bitmap *) xmalloc (sizeof (bitmap) * currbbs);
! for (i = 0; i < currbbs; i++)
! pre_dfs[i] = BITMAP_XMALLOC ();
! compute_dominance_frontiers (pre_dfs, pre_idom);
! idfs_cache = xcalloc (currbbs, sizeof (bitmap));
! }
}
ggc_pop_context ();
/* Debugging dumps. */
--- 2939,2945 ----
htab_delete (ephi_pindex_htab);
ephi_pindex_htab = NULL;
}
! ggc_collect ();
}
ggc_pop_context ();
/* Debugging dumps. */