diff options
author | Richard Guenther <rguenther@suse.de> | 2010-02-16 16:11:28 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-02-16 16:11:28 +0000 |
commit | b09bae6856c0869e7e763e5a13154210bb5f54bc (patch) | |
tree | 4620ddaac26a3bc34efc63a8e2cd6bb8afe8224c /gcc/tree-vrp.c | |
parent | d779a591998fee3b37d458c1f44af6cc882fd400 (diff) | |
download | gcc-b09bae6856c0869e7e763e5a13154210bb5f54bc.zip gcc-b09bae6856c0869e7e763e5a13154210bb5f54bc.tar.gz gcc-b09bae6856c0869e7e763e5a13154210bb5f54bc.tar.bz2 |
re PR middle-end/41043 (virtual memory exhausted: Cannot allocate memory)
2010-02-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/41043
* tree-vrp.c (vrp_var_may_overflow): Only ask SCEV for
real loops.
(vrp_visit_assignment_or_call): Do not ask SCEV for regular
statements ...
(vrp_visit_phi_node): ... but only for loop PHI nodes.
* gfortran.dg/pr41043.f90: New testcase.
* gcc.dg/Wstrict-overflow-18.c: XFAIL.
From-SVN: r156808
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 8164548..2f0f059 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -3280,7 +3280,8 @@ vrp_var_may_overflow (tree var, gimple stmt) return true; l = loop_containing_stmt (stmt); - if (l == NULL) + if (l == NULL + || !loop_outer (l)) return true; chrec = instantiate_parameters (l, analyze_scalar_evolution (l, var)); @@ -5342,7 +5343,6 @@ vrp_visit_assignment_or_call (gimple stmt, tree *output_p) && TYPE_MAX_VALUE (TREE_TYPE (lhs))) || POINTER_TYPE_P (TREE_TYPE (lhs)))) { - struct loop *l; value_range_t new_vr = { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL }; if (code == GIMPLE_CALL) @@ -5350,12 +5350,6 @@ vrp_visit_assignment_or_call (gimple stmt, tree *output_p) else extract_range_from_assignment (&new_vr, stmt); - /* If STMT is inside a loop, we may be able to know something - else about the range of LHS by examining scalar evolution - information. */ - if (current_loops && (l = loop_containing_stmt (stmt))) - adjust_range_with_scev (&new_vr, l, stmt, lhs); - if (update_value_range (lhs, &new_vr)) { *output_p = lhs; @@ -6259,6 +6253,7 @@ vrp_visit_phi_node (gimple phi) value_range_t *lhs_vr = get_value_range (lhs); value_range_t vr_result = { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL }; int edges, old_edges; + struct loop *l; copy_value_range (&vr_result, lhs_vr); @@ -6322,6 +6317,14 @@ vrp_visit_phi_node (gimple phi) } } + /* If this is a loop PHI node SCEV may known more about its + value-range. + ??? Identify loop PHI nodes properly. */ + if (current_loops + && (l = loop_containing_stmt (phi)) + && loop_outer (l)) + adjust_range_with_scev (&vr_result, l, phi, lhs); + if (vr_result.type == VR_VARYING) goto varying; |