diff options
author | Jeff Law <law@redhat.com> | 2006-03-13 09:32:34 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2006-03-13 09:32:34 -0700 |
commit | 2bbec6d92d3c0fbba419fbc42e3153c27e9425ff (patch) | |
tree | 8368c4845123c9fa781a8a6464317eacd7412780 /gcc/tree-vrp.c | |
parent | 96c30d2afccff71991a17f7c9c14e7b2c99dc7de (diff) | |
download | gcc-2bbec6d92d3c0fbba419fbc42e3153c27e9425ff.zip gcc-2bbec6d92d3c0fbba419fbc42e3153c27e9425ff.tar.gz gcc-2bbec6d92d3c0fbba419fbc42e3153c27e9425ff.tar.bz2 |
tree-vrp.c (stmt_interesting_for_vrp): Some statements with virtual operands are interesting.
* tree-vrp.c (stmt_interesting_for_vrp): Some statements with
virtual operands are interesting.
(vrp_visit_stmt): Corresponding changes.
* gcc.dg/tree-ssa/20030807-2.c: No longer expected to fail.
From-SVN: r112011
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index e126fea..278347d 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -3266,11 +3266,19 @@ stmt_interesting_for_vrp (tree stmt) else if (TREE_CODE (stmt) == MODIFY_EXPR) { tree lhs = TREE_OPERAND (stmt, 0); + tree rhs = TREE_OPERAND (stmt, 1); + /* In general, assignments with virtual operands are not useful + for deriving ranges, with the obvious exception of calls to + builtin functions. */ if (TREE_CODE (lhs) == SSA_NAME && (INTEGRAL_TYPE_P (TREE_TYPE (lhs)) || POINTER_TYPE_P (TREE_TYPE (lhs))) - && ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)) + && ((TREE_CODE (rhs) == CALL_EXPR + && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR + && DECL_P (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0)) + && DECL_IS_BUILTIN (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0))) + || ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))) return true; } else if (TREE_CODE (stmt) == COND_EXPR || TREE_CODE (stmt) == SWITCH_EXPR) @@ -3739,9 +3747,20 @@ vrp_visit_stmt (tree stmt, edge *taken_edge_p, tree *output_p) } ann = stmt_ann (stmt); - if (TREE_CODE (stmt) == MODIFY_EXPR - && ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)) - return vrp_visit_assignment (stmt, output_p); + if (TREE_CODE (stmt) == MODIFY_EXPR) + { + tree rhs = TREE_OPERAND (stmt, 1); + + /* In general, assignments with virtual operands are not useful + for deriving ranges, with the obvious exception of calls to + builtin functions. */ + if ((TREE_CODE (rhs) == CALL_EXPR + && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR + && DECL_P (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0)) + && DECL_IS_BUILTIN (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0))) + || ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)) + return vrp_visit_assignment (stmt, output_p); + } else if (TREE_CODE (stmt) == COND_EXPR || TREE_CODE (stmt) == SWITCH_EXPR) return vrp_visit_cond_stmt (stmt, taken_edge_p); |