This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Use number of iteration analysis from VRP
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Richard Guenther <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 27 Nov 2010 14:08:37 -0800
- Subject: Re: [PATCH] Use number of iteration analysis from VRP
- References: <alpine.LNX.2.00.1008271653170.28912@zhemvz.fhfr.qr>
On Fri, Aug 27, 2010 at 7:57 AM, Richard Guenther <rguenther@suse.de> wrote:
>
> This makes VRP use number of iteration analysis to derive upper bounds
> for loop induction variables. ?Currently we only use SCEV to determine
> the initial value and drop the upper bound to INF when iterating the
> PHI node during propagation.
>
> A first variant uncovered may out-of-bound array accesses (you saw
> my patches to the testsuite), one somewhere in Boehm-GC. ?Those
> were all turned into infinite loops by optimizing away the exit
> test ... I figured that's not a good idea and thus added a flag
> to number of iteration analysis to disregard deriving bounds from
> out-of-bound accesses and other undefined behavior.
>
> The following patch still miscompiles CXB3014 due to PR45427, so
> the patch is a good test for our number of iteration analysis ...
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu.
>
> Comments welcome - I have to wait until PR45427 is fixed anyways.
>
> Thanks,
> Richard.
>
> 2010-08-27 ?Richard Guenther ?<rguenther@suse.de>
>
> ? ? ? ?* tree-vrp.c (adjust_range_with_scev): Use number of iteration
> ? ? ? ?estimate.
> ? ? ? ?(vrp_visit_phi_node): Delay using SCEV till we balloon the
> ? ? ? ?range.
> ? ? ? ?(execute_vrp): Compute number of iteration estimates.
> ? ? ? ?* cfgloop.h (estimate_numbers_of_iterations_loop): Adjust prototype.
> ? ? ? ?* tree-flow.h (estimate_numbers_of_iterations): Likewise.
> ? ? ? ?* tree-data-ref.c (estimated_loop_iterations): Adjust.
> ? ? ? ?* tree-ssa-loop-niter.c (estimate_numbers_of_iterations_loop):
> ? ? ? ?Infer loop bounds from undefined behavior based on a new
> ? ? ? ?parameter.
> ? ? ? ?(estimate_numbers_of_iterations): Likewise.
> ? ? ? ?(scev_probably_wraps_p): Adjust.
> ? ? ? ?* tree-ssa-loop.c (tree_ssa_loop_bounds): Likewise.
>
> ? ? ? ?* gcc.dg/vect/vect-outer-fir.c: Adjust.
> ? ? ? ?* gcc.dg/tree-ssa/vrp54.c: New testcase.
>
This may have caused:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46675
H.J.