summaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-25 19:55:13 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-25 19:55:13 +0000
commit50258e8d5b4cc66bded7be6c5c63b2701f3c31bb (patch)
tree1051acd0e95bb68a9fb8523beb6287d28959dd24 /gcc/tree-vrp.c
parent9afbc64b01e33a7b5a22bb85cd2e4fb0dc263edf (diff)
downloadgcc-50258e8d5b4cc66bded7be6c5c63b2701f3c31bb.tar.gz
* tree-vrp.c (identify_jump_threads): Handle GIMPLE_SWITCH too.
* gcc.dg/tree-ssa/vrp56.c: new test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172938 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 466c3a0f0da..2d0af8725da 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -7555,25 +7555,25 @@ identify_jump_threads (void)
may be some value in handling SWITCH_EXPR here, I doubt it's
terribly important. */
last = gsi_stmt (gsi_last_bb (bb));
- if (gimple_code (last) != GIMPLE_COND)
- continue;
- /* We're basically looking for any kind of conditional with
+ /* We're basically looking for a switch or any kind of conditional with
integral or pointer type arguments. Note the type of the second
argument will be the same as the first argument, so no need to
check it explicitly. */
- if (TREE_CODE (gimple_cond_lhs (last)) == SSA_NAME
- && (INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (last)))
- || POINTER_TYPE_P (TREE_TYPE (gimple_cond_lhs (last))))
- && (TREE_CODE (gimple_cond_rhs (last)) == SSA_NAME
- || is_gimple_min_invariant (gimple_cond_rhs (last))))
+ if (gimple_code (last) == GIMPLE_SWITCH
+ || (gimple_code (last) == GIMPLE_COND
+ && TREE_CODE (gimple_cond_lhs (last)) == SSA_NAME
+ && (INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (last)))
+ || POINTER_TYPE_P (TREE_TYPE (gimple_cond_lhs (last))))
+ && (TREE_CODE (gimple_cond_rhs (last)) == SSA_NAME
+ || is_gimple_min_invariant (gimple_cond_rhs (last)))))
{
edge_iterator ei;
/* We've got a block with multiple predecessors and multiple
- successors which also ends in a suitable conditional. For
- each predecessor, see if we can thread it to a specific
- successor. */
+ successors which also ends in a suitable conditional or
+ switch statement. For each predecessor, see if we can thread
+ it to a specific successor. */
FOR_EACH_EDGE (e, ei, bb->preds)
{
/* Do not thread across back edges or abnormal edges