summaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2011-04-25 13:55:13 -0600
committerJeff Law <law@gcc.gnu.org>2011-04-25 13:55:13 -0600
commit1f3fcdc3a9a53a41a5fc680e284b4ac23316d179 (patch)
tree1051acd0e95bb68a9fb8523beb6287d28959dd24 /gcc/tree-vrp.c
parent328db4501ef4e87dd8f50209a9d1eeb8f77ff783 (diff)
downloadgcc-1f3fcdc3a9a53a41a5fc680e284b4ac23316d179.tar.gz
tree-vrp.c (identify_jump_threads): Handle GIMPLE_SWITCH too.
* tree-vrp.c (identify_jump_threads): Handle GIMPLE_SWITCH too. * gcc.dg/tree-ssa/vrp56.c: new test. From-SVN: r172938
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