Richard Guenther - Re: [PATCH] Make VRP recognize range tests (unsigned)a + CST <= CST2 (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing 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]

On Tue, 6 Feb 2007, Richard Guenther wrote:

This patch makes VRP recognize range and anti-range tests. It does so by allowing more flexible ASSERT_EXPRs (which is neccessary for the anti-range case) like

ASSERT_EXPR <a_1, (unsigned)a_1 + 5 > 13>

and derive ranges and anti-ranges from such directly.

This transformation triggers quite a few times during a C only gcc bootstrap (around 30000 times) due to tree code and tree code class checks.

Bootstrapped and tested on x86_64-unknown-linux-gnu for all languages including Ada.

Ok for mainline?

This results in 0.003% overall size reduction in all of stage2 gcc/*.o. Currently we drop to varying very early for operations on anti-ranges but I have some patches pending to improve this.

I'll put it on the c++tester tonight as well.

Richard.

2007-01-20 Richard Guenther rguenther@suse.de

* tree-vrp.c (set_value_range_auto): New function.
(struct assert_locus_d): New member EXPR.
(register_new_assert_for): Add EXPR parameter to support
ASSERT_EXPR <name, expr OP limit>.
(register_edge_assert_for_1): Adjust callers.
(find_assert_locations): Likewise.
(process_assert_insertions_for): Build condition from
expression.
(extract_range_from_assert): Handle ASSERT_EXPRs
of the form ASSERT_EXPR <name, expr OP limit>.
(register_edge_assert_for_2): New helper registering
asserts for comparisons.  Recognize range tests of the form
(unsigned)i - CST1 OP CST2.
(register_edge_assert_for_1): Use it.
(register_edge_assert_for): Likewise.

* gcc.dg/tree-ssa/vrp33.c: New testcase.
* gcc.dg/tree-ssa/vrp34.c: Likewise.
* gcc.dg/tree-ssa/vrp35.c: Likewise.

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