aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-low.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-01-29 12:02:46 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2014-01-29 12:02:46 +0100
commit09b22f48d435d158761a02117facec4daa7395fb (patch)
tree4b721b57c74c1349afc462b869e17ae0bdb8fa90 /gcc/gimple-low.c
parent42eb8bd17982621ad29ec491053851fd2d0d740e (diff)
downloadgcc-09b22f48d435d158761a02117facec4daa7395fb.zip
gcc-09b22f48d435d158761a02117facec4daa7395fb.tar.gz
gcc-09b22f48d435d158761a02117facec4daa7395fb.tar.bz2
re PR middle-end/59917 (ICE in calc_dfs_tree, at dominance.c:401)
PR middle-end/59917 PR tree-optimization/59920 * tree.c (build_common_builtin_nodes): Remove __builtin_setjmp_dispatcher initialization. * omp-low.h (make_gimple_omp_edges): Add a new int * argument. * profile.c (branch_prob): Use gsi_start_nondebug_after_labels_bb instead of gsi_after_labels + manually skipping debug stmts. Don't ignore bbs with BUILT_IN_SETJMP_DISPATCHER, instead ignore bbs with IFN_ABNORMAL_DISPATCHER. * tree-inline.c (copy_edges_for_bb): Remove can_make_abnormal_goto argument, instead add abnormal_goto_dest argument. Ignore computed_goto_p stmts. Don't call make_abnormal_goto_edges. If a call might need abnormal edges for non-local gotos, see if it already has an edge to IFN_ABNORMAL_DISPATCHER or if it is IFN_ABNORMAL_DISPATCHER with true argument, don't do anything then, otherwise add EDGE_ABNORMAL from the call's bb to abnormal_goto_dest. (copy_cfg_body): Compute abnormal_goto_dest, adjust copy_edges_for_bb caller. * gimple-low.c (struct lower_data): Remove calls_builtin_setjmp. (lower_function_body): Don't emit __builtin_setjmp_dispatcher. (lower_stmt): Don't set data->calls_builtin_setjmp. (lower_builtin_setjmp): Adjust comment. * builtins.def (BUILT_IN_SETJMP_DISPATCHER): Remove. * tree-cfg.c (found_computed_goto): Remove. (factor_computed_gotos): Remove. (make_goto_expr_edges): Return bool, true for computed gotos. Don't call make_abnormal_goto_edges. (build_gimple_cfg): Don't set found_computed_goto, don't call factor_computed_gotos. (computed_goto_p): No longer static. (make_blocks): Don't set found_computed_goto. (get_abnormal_succ_dispatcher, handle_abnormal_edges): New functions. (make_edges): If make_goto_expr_edges returns true, push bb into ab_edge_goto vector, for stmt_can_make_abnormal_goto calls instead of calling make_abnormal_goto_edges push bb into ab_edge_call vector. Record mapping between bbs and OpenMP regions if there are any, adjust make_gimple_omp_edges caller. Call handle_abnormal_edges. (make_abnormal_goto_edges): Remove. * tree-cfg.h (make_abnormal_goto_edges): Remove. (computed_goto_p, get_abnormal_succ_dispatcher): New prototypes. * internal-fn.c (expand_ABNORMAL_DISPATCHER): New function. * builtins.c (expand_builtin): Don't handle BUILT_IN_SETJMP_DISPATCHER. * internal-fn.def (ABNORMAL_DISPATCHER): New. * omp-low.c (make_gimple_omp_edges): Add region_idx argument, when filling *region also set *region_idx to (*region)->entry->index. * gcc.dg/pr59920-1.c: New test. * gcc.dg/pr59920-2.c: New test. * gcc.dg/pr59920-3.c: New test. * c-c++-common/gomp/pr59917-1.c: New test. * c-c++-common/gomp/pr59917-2.c: New test. From-SVN: r207231
Diffstat (limited to 'gcc/gimple-low.c')
-rw-r--r--gcc/gimple-low.c51
1 files changed, 7 insertions, 44 deletions
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 8d2e711..c60e817 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -76,9 +76,6 @@ struct lower_data
/* True if the current statement cannot fall through. */
bool cannot_fallthru;
-
- /* True if the function calls __builtin_setjmp. */
- bool calls_builtin_setjmp;
};
static void lower_stmt (gimple_stmt_iterator *, struct lower_data *);
@@ -99,7 +96,6 @@ lower_function_body (void)
gimple_seq lowered_body;
gimple_stmt_iterator i;
gimple bind;
- tree t;
gimple x;
/* The gimplifier should've left a body of exactly one statement,
@@ -146,34 +142,6 @@ lower_function_body (void)
gsi_insert_after (&i, t.stmt, GSI_CONTINUE_LINKING);
}
- /* If the function calls __builtin_setjmp, we need to emit the computed
- goto that will serve as the unique dispatcher for all the receivers. */
- if (data.calls_builtin_setjmp)
- {
- tree disp_label, disp_var, arg;
-
- /* Build 'DISP_LABEL:' and insert. */
- disp_label = create_artificial_label (cfun->function_end_locus);
- /* This mark will create forward edges from every call site. */
- DECL_NONLOCAL (disp_label) = 1;
- cfun->has_nonlocal_label = 1;
- x = gimple_build_label (disp_label);
- gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
-
- /* Build 'DISP_VAR = __builtin_setjmp_dispatcher (DISP_LABEL);'
- and insert. */
- disp_var = create_tmp_var (ptr_type_node, "setjmpvar");
- arg = build_addr (disp_label, current_function_decl);
- t = builtin_decl_implicit (BUILT_IN_SETJMP_DISPATCHER);
- x = gimple_build_call (t, 1, arg);
- gimple_call_set_lhs (x, disp_var);
-
- /* Build 'goto DISP_VAR;' and insert. */
- gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
- x = gimple_build_goto (disp_var);
- gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
- }
-
/* Once the old body has been lowered, replace it with the new
lowered sequence. */
gimple_set_body (current_function_decl, lowered_body);
@@ -364,7 +332,6 @@ lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data)
{
lower_builtin_setjmp (gsi);
data->cannot_fallthru = false;
- data->calls_builtin_setjmp = true;
return;
}
@@ -689,15 +656,12 @@ lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data)
all will be used on all machines). It operates similarly to the C
library function of the same name, but is more efficient.
- It is lowered into 3 other builtins, namely __builtin_setjmp_setup,
- __builtin_setjmp_dispatcher and __builtin_setjmp_receiver, but with
- __builtin_setjmp_dispatcher shared among all the instances; that's
- why it is only emitted at the end by lower_function_body.
+ It is lowered into 2 other builtins, namely __builtin_setjmp_setup,
+ __builtin_setjmp_receiver.
After full lowering, the body of the function should look like:
{
- void * setjmpvar.0;
int D.1844;
int D.2844;
@@ -727,14 +691,13 @@ lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data)
<D3850>:;
return;
- <D3853>: [non-local];
- setjmpvar.0 = __builtin_setjmp_dispatcher (&<D3853>);
- goto setjmpvar.0;
}
- The dispatcher block will be both the unique destination of all the
- abnormal call edges and the unique source of all the abnormal edges
- to the receivers, thus keeping the complexity explosion localized. */
+ During cfg creation an extra per-function (or per-OpenMP region)
+ block with ABNORMAL_DISPATCHER internal call will be added, unique
+ destination of all the abnormal call edges and the unique source of
+ all the abnormal edges to the receivers, thus keeping the complexity
+ explosion localized. */
static void
lower_builtin_setjmp (gimple_stmt_iterator *gsi)