Commit 0f379f76 by Easwaran Raman Committed by Easwaran Raman

re PR target/54938 (sh libgcc_unpack_df.o fails to build:…

re PR target/54938 (sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273)

2012-10-31   Easwaran Raman  <eraman@google.com>

	PR target/54938
	PR middle-end/54957
	* optabs.c (emit_cmp_and_jump_insn_1): Add REG_BR_PROB note
	only if it doesn't already exist.
	* stmt.c (get_outgoing_edge_probs): Return 0 if BB is NULL.
	(emit_case_dispatch_table): Handle the case where STMT_BB is
	NULL.
	(expand_sjlj_dispatch_table): Pass BB containing before_case
	to emit_case_dispatch_table.

From-SVN: r193052
parent 5d59b5e1
2012-10-31 Easwaran Raman <eraman@google.com>
PR target/54938
PR middle-end/54957
* optabs.c (emit_cmp_and_jump_insn_1): Add REG_BR_PROB note
only if it doesn't already exist.
* stmt.c (get_outgoing_edge_probs): Return 0 if BB is NULL.
(emit_case_dispatch_table): Handle the case where STMT_BB is
NULL.
(expand_sjlj_dispatch_table): Pass BB containing before_case
to emit_case_dispatch_table.
2012-10-31 Lawrence Crowl <crowl@google.com> 2012-10-31 Lawrence Crowl <crowl@google.com>
* is-a.h: New. * is-a.h: New.
...@@ -4268,11 +4268,9 @@ emit_cmp_and_jump_insn_1 (rtx test, enum machine_mode mode, rtx label, int prob) ...@@ -4268,11 +4268,9 @@ emit_cmp_and_jump_insn_1 (rtx test, enum machine_mode mode, rtx label, int prob)
&& profile_status != PROFILE_ABSENT && profile_status != PROFILE_ABSENT
&& insn && insn
&& JUMP_P (insn) && JUMP_P (insn)
&& any_condjump_p (insn)) && any_condjump_p (insn)
{ && !find_reg_note (insn, REG_BR_PROB, 0))
gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0)); add_reg_note (insn, REG_BR_PROB, GEN_INT (prob));
add_reg_note (insn, REG_BR_PROB, GEN_INT (prob));
}
} }
/* Generate code to compare X with Y so that the condition codes are /* Generate code to compare X with Y so that the condition codes are
......
...@@ -1867,6 +1867,8 @@ get_outgoing_edge_probs (basic_block bb) ...@@ -1867,6 +1867,8 @@ get_outgoing_edge_probs (basic_block bb)
edge e; edge e;
edge_iterator ei; edge_iterator ei;
int prob_sum = 0; int prob_sum = 0;
if (!bb)
return 0;
FOR_EACH_EDGE(e, ei, bb->succs) FOR_EACH_EDGE(e, ei, bb->succs)
prob_sum += e->probability; prob_sum += e->probability;
return prob_sum; return prob_sum;
...@@ -1916,8 +1918,8 @@ emit_case_dispatch_table (tree index_expr, tree index_type, ...@@ -1916,8 +1918,8 @@ emit_case_dispatch_table (tree index_expr, tree index_type,
rtx fallback_label = label_rtx (case_list->code_label); rtx fallback_label = label_rtx (case_list->code_label);
rtx table_label = gen_label_rtx (); rtx table_label = gen_label_rtx ();
bool has_gaps = false; bool has_gaps = false;
edge default_edge = EDGE_SUCC(stmt_bb, 0); edge default_edge = stmt_bb ? EDGE_SUCC(stmt_bb, 0) : NULL;
int default_prob = default_edge->probability; int default_prob = default_edge ? default_edge->probability : 0;
int base = get_outgoing_edge_probs (stmt_bb); int base = get_outgoing_edge_probs (stmt_bb);
bool try_with_tablejump = false; bool try_with_tablejump = false;
...@@ -1997,7 +1999,8 @@ emit_case_dispatch_table (tree index_expr, tree index_type, ...@@ -1997,7 +1999,8 @@ emit_case_dispatch_table (tree index_expr, tree index_type,
default_prob = 0; default_prob = 0;
} }
default_edge->probability = default_prob; if (default_edge)
default_edge->probability = default_prob;
/* We have altered the probability of the default edge. So the probabilities /* We have altered the probability of the default edge. So the probabilities
of all other edges need to be adjusted so that it sums up to of all other edges need to be adjusted so that it sums up to
...@@ -2289,7 +2292,8 @@ expand_sjlj_dispatch_table (rtx dispatch_index, ...@@ -2289,7 +2292,8 @@ expand_sjlj_dispatch_table (rtx dispatch_index,
emit_case_dispatch_table (index_expr, index_type, emit_case_dispatch_table (index_expr, index_type,
case_list, default_label, case_list, default_label,
minval, maxval, range, NULL); minval, maxval, range,
BLOCK_FOR_INSN (before_case));
emit_label (default_label); emit_label (default_label);
free_alloc_pool (case_node_pool); free_alloc_pool (case_node_pool);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment