aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-04-02 12:54:08 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-04-02 12:54:08 +0000
commitb7814a183ca564e2d8cf21c12364d13d8f1226a2 (patch)
treeaff8bcca1cbe2777fd11b65bc13de7e52af54d3b /gcc/expr.c
parent8aea0bf08194b3bb9699c0a71ad02284b7a4ebc0 (diff)
downloadgcc-b7814a183ca564e2d8cf21c12364d13d8f1226a2.zip
gcc-b7814a183ca564e2d8cf21c12364d13d8f1226a2.tar.gz
gcc-b7814a183ca564e2d8cf21c12364d13d8f1226a2.tar.bz2
re PR tree-optimization/14495 ([tree-ssa] Propagate range info into a switch statement)
2008-04-02 Richard Guenther <rguenther@suse.de> PR tree-optimization/14495 PR tree-optimization/34793 * tree-vrp.c (struct switch_update): New structure. (to_remove_edges, to_update_switch_stmts): New VECs. (simplify_switch_using_ranges): New function. Remove not taken case labels and edges. (simplify_stmt_using_ranges): Call it. (identify_jump_threads): Mark edges we have queued for removal so we don't thread them. (execute_vrp): Remove edges queued for removal, update SWITCH_STMT case label vector. * tree-cfg.c (group_case_labels): Deal with missing default label. (tree_verify_flow_info): Allow missing default label. * stmt.c (emit_case_bit_tests): Deal with NULL default_label. (emit_case_nodes): Likewise. (expand_case): Do not rely on the default label to be present. * expr.c (try_casesi): Deal with NULL default_label. (do_tablejump): Likewise. * gcc.dg/tree-ssa/vrp41.c: New testcase. * gcc.dg/tree-ssa/vrp42.c: Likewise. From-SVN: r133835
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index dbb2b4c..a2bd86c 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -9851,8 +9851,9 @@ try_casesi (tree index_type, tree index_expr, tree minval, tree range,
index_expr, minval);
minval = integer_zero_node;
index = expand_normal (index_expr);
- emit_cmp_and_jump_insns (rangertx, index, LTU, NULL_RTX,
- omode, 1, default_label);
+ if (default_label)
+ emit_cmp_and_jump_insns (rangertx, index, LTU, NULL_RTX,
+ omode, 1, default_label);
/* Now we can safely truncate. */
index = convert_to_mode (index_mode, index, 0);
}
@@ -9931,8 +9932,9 @@ do_tablejump (rtx index, enum machine_mode mode, rtx range, rtx table_label,
or equal to the minimum value of the range and less than or equal to
the maximum value of the range. */
- emit_cmp_and_jump_insns (index, range, GTU, NULL_RTX, mode, 1,
- default_label);
+ if (default_label)
+ emit_cmp_and_jump_insns (index, range, GTU, NULL_RTX, mode, 1,
+ default_label);
/* If index is in range, it must fit in Pmode.
Convert to Pmode so we can index with it. */