+2012-07-22 Steven Bosscher <steven@gcc.gnu.org>
+
+ PR tree-optimization/53881
+ * tree-cfg.c (group_case_labels_stmt): Look up the basic block
+ for each label and compare them instead of labels.
+
2012-07-22 Steven Bosscher <steven@gcc.gnu.org>
* opts.c (common_handle_option): Do not set
+2012-07-22 Steven Bosscher <steven@gcc.gnu.org>
+
+ PR tree-optimization/53881
+ * gcc.dg/pr53881.c: Renamed to ...
+ * gcc.dg/pr53881-1.c: ... this.
+ * gcc.dg/pr53881-2.c: New test.
+
2012-07-22 Hans-Peter Nilsson <hp@axis.com>
Handle recent changes in default atomics for cris*-*-linux*.
{
int old_size = gimple_switch_num_labels (stmt);
int i, j, new_size = old_size;
- tree default_case = NULL_TREE;
- tree default_label = NULL_TREE;
+ basic_block default_bb = NULL;
bool has_default;
/* The default label is always the first case in a switch
if (!CASE_LOW (gimple_switch_default_label (stmt))
&& !CASE_HIGH (gimple_switch_default_label (stmt)))
{
- default_case = gimple_switch_default_label (stmt);
- default_label = CASE_LABEL (default_case);
+ tree default_case = gimple_switch_default_label (stmt);
+ default_bb = label_to_block (CASE_LABEL (default_case));
has_default = true;
}
else
i = 0;
while (i < old_size)
{
- tree base_case, base_label, base_high;
+ tree base_case, base_high;
+ basic_block base_bb;
+
base_case = gimple_switch_label (stmt, i);
gcc_assert (base_case);
- base_label = CASE_LABEL (base_case);
+ base_bb = label_to_block (CASE_LABEL (base_case));
/* Discard cases that have the same destination as the
default case. */
- if (base_label == default_label)
+ if (base_bb == default_bb)
{
gimple_switch_set_label (stmt, i, NULL_TREE);
i++;
while (i < old_size)
{
tree merge_case = gimple_switch_label (stmt, i);
- tree merge_label = CASE_LABEL (merge_case);
+ basic_block merge_bb = label_to_block (CASE_LABEL (merge_case));
double_int bhp1 = double_int_add (tree_to_double_int (base_high),
double_int_one);
/* Merge the cases if they jump to the same place,
and their ranges are consecutive. */
- if (merge_label == base_label
+ if (merge_bb == base_bb
&& double_int_equal_p (tree_to_double_int (CASE_LOW (merge_case)),
bhp1))
{