Denis Vlasenko wrote:
> This patch adds value range propagation for (a&b), (a|b) operations.
>
> tree-vrp.c.diff is the patch itself, test_vrp.c is a test program.
>
> Differences in *.vrp (-fdump-tree-vrp output) and assembly generated
> with stock 4.1.1 and with patched one out of test program test_vrp.c
> are below the sig.
>
> I am not familiar with gcc internals, so please review carefully before
> applying. For example, I construct integer contants like this:
>
> tmp = build_int_cst (NULL_TREE, 1);
>
> while Andrew Pinski does it like this:
>
> max = build_int_cst (TREE_TYPE (expr), 1);
Both of you are wrong for the specific case of "1", it should be
integer_one_node. Zero should be integer_zero_node.
Other than that, if you pass NULL as the type, it will assume you mean
"integer_type_node".
When working with oring/etc where it may matter what the size of the
type of the variable is, you should use the type of the original operand.
If it doesn't matter, feel free to pass NULL.