On Sun, Nov 20, 2016 at 07:20:20PM +0530, Prathamesh Kulkarni wrote:
> --- a/gcc/tree-vrp.c
> +++ b/gcc/tree-vrp.c
> @@ -4013,6 +4013,16 @@ extract_range_basic (value_range *vr, gimple *stmt)
> : vrp_val_max (type), NULL);
> }
> return;
> + case CFN_BUILT_IN_STRLEN:
> + {
> + tree type = TREE_TYPE (gimple_call_lhs (stmt));
> + unsigned HOST_WIDE_INT max =
> + TREE_INT_CST_LOW (vrp_val_max (ptrdiff_type_node)) - 1;
Wrong formatting, = should go on the next line, and should be indented only
2 columns more than the previous line. Plus TREE_INT_CST_LOW really
shouldn't be used in new code. You should use tree_to_uhwi or tree_to_shwi
instead. Why the -1? Can you just
fold_convert (type, TYPE_MAX_VALUE (ptrdiff_type_node)); ?
Or, if you really want the -1, e.g. wide_int max = vrp_val_max
(ptrdiff_type_node);
wide_int_to_tree (type, max - 1);
or something similar.
> +
> + set_value_range (vr, VR_RANGE, build_int_cst (type, 0),
> + build_int_cst (type, max), NULL);
> + }
> + return;
> default:
> break;
> }
Jakub