diff options
Diffstat (limited to 'gcc/tree-dfa.c')
-rw-r--r-- | gcc/tree-dfa.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 0482b05..1d20de0 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-iterator.h" #include "gimple-walk.h" #include "tree-dfa.h" +#include "gimple-range.h" /* Build and maintain data flow information for trees. */ @@ -394,6 +395,11 @@ get_ref_base_and_extent (tree exp, poly_int64_pod *poffset, size_tree = DECL_SIZE (TREE_OPERAND (exp, 1)); else if (TREE_CODE (exp) == BIT_FIELD_REF) size_tree = TREE_OPERAND (exp, 1); + else if (TREE_CODE (exp) == WITH_SIZE_EXPR) + { + size_tree = TREE_OPERAND (exp, 1); + exp = TREE_OPERAND (exp, 0); + } else if (!VOID_TYPE_P (TREE_TYPE (exp))) { machine_mode mode = TYPE_MODE (TREE_TYPE (exp)); @@ -530,14 +536,23 @@ get_ref_base_and_extent (tree exp, poly_int64_pod *poffset, index. */ seen_variable_array_ref = true; - wide_int min, max; + value_range vr; + range_query *query; + if (cfun) + query = get_range_query (cfun); + else + query = get_global_range_query (); + if (TREE_CODE (index) == SSA_NAME && (low_bound = array_ref_low_bound (exp), poly_int_tree_p (low_bound)) && (unit_size = array_ref_element_size (exp), TREE_CODE (unit_size) == INTEGER_CST) - && get_range_info (index, &min, &max) == VR_RANGE) + && query->range_of_expr (vr, index) + && vr.kind () == VR_RANGE) { + wide_int min = vr.lower_bound (); + wide_int max = vr.upper_bound (); poly_offset_int lbound = wi::to_poly_offset (low_bound); /* Try to constrain maxsize with range information. */ offset_int omax |