summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-31 10:18:36 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-31 10:18:36 +0000
commitb787f5e5aec4e644f4dbfb9b4038f65821bf569a (patch)
tree03546cea2e85d029b448847ecd142555b3ffec6e /gcc/tree-ssa-dom.c
parent0f50072e9a93b49d0510128adafe9c5f22813e73 (diff)
downloadgcc-b787f5e5aec4e644f4dbfb9b4038f65821bf569a.tar.gz
* tree-ssa-dom.c (record_equivalences_from_incoming_edge):
Only look at case labels if the immediate dominator is also the only predecessor. Don't look for more case labels if the first seen is a case range. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82480 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index c74dd5d5325..0ca36b09c80 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1450,9 +1450,12 @@ record_equivalences_from_incoming_edge (struct dom_walk_data *walk_data,
&bd->avail_exprs,
bb,
&bd->vrp_variables);
- /* Similarly when the parent block ended in a SWITCH_EXPR. */
+ /* Similarly when the parent block ended in a SWITCH_EXPR.
+ We can only know the value of the switch's condition if the dominator
+ parent is also the only predecessor of this block. */
else if (parent_block_last_stmt
&& bb->pred->pred_next == NULL
+ && bb->pred->src == parent
&& TREE_CODE (parent_block_last_stmt) == SWITCH_EXPR)
{
tree switch_cond = SWITCH_COND (parent_block_last_stmt);
@@ -1473,7 +1476,7 @@ record_equivalences_from_incoming_edge (struct dom_walk_data *walk_data,
tree elt = TREE_VEC_ELT (switch_vec, i);
if (label_to_block (CASE_LABEL (elt)) == bb)
{
- if (++case_count > 1)
+ if (++case_count > 1 || CASE_HIGH (elt))
break;
match_case = elt;
}
@@ -1484,6 +1487,7 @@ record_equivalences_from_incoming_edge (struct dom_walk_data *walk_data,
the exact value of SWITCH_COND which caused us to get to
this block. Record that equivalence in EQ_EXPR_VALUE. */
if (case_count == 1
+ && match_case
&& CASE_LOW (match_case)
&& !CASE_HIGH (match_case))
{