This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] add VRP for bitwise OR and AND


On 8/7/06, Daniel Berlin <dannyb@google.com> wrote:
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.


(I didn't look at the patch) You should always use build_int_cst (whatever-type-you-need, 1) instead of integer_one_node or integer_zero_node. At least once you start feeding this node to helpers in the middle-end.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]