[PATCH PR45098, 7/10] Nowrap limits iterations

Tom de Vries vries@codesourcery.com
Sat Jun 11 10:13:00 GMT 2011


Hi Zdenek,

On 05/31/2011 10:04 AM, Zdenek Dvorak wrote:
> Hi,
> 
>> As far as I can tell, what is current calculated in i_bound (and assigned to
>> nb_iterations_upper_bound), is the maximum amount of times any statement in the
>> loop is executed, where any includes exit tests. Differently put, the maximum
>> amount of times the loop header is executed.
> 
> hmm... this is rather confusing, I don't really recall why I gave
> nb_iterations_upper_bound a different semantics from any other instance
> of what # of iterations of a loop means.  
> 
>> This is confirmed by this comment in tree-vrp.c:
>>
>>   /* Try to use estimated number of iterations for the loop to constrain the
>>      final value in the evolution.
>>      We are interested in the number of executions of the latch, while
>>      nb_iterations_upper_bound includes the last execution of the exit test.  */
>>
>> I modified the patch to improved the comment.
> 
> I think a better fix would be to make the nb_iterations_upper_bound semantics
> consistent with that of nb_iterations.  Let me try to do it, hopefully this should
> be mostly mechanical,
> 

This patch changes the semantics of nb_iterations_upper_bound and
nb_iterations_estimate, to mean: the amount of latch executions.

That change is countered at all use sites, except for
tree-ssa-loop-ivopts.c:may_eliminate_iv.

Passed x86_64 bootstrapping and reg-testing.

OK for trunk?

2011-06-10  Zdenek Dvorak  <ook@ucw.cz>
	    Tom de Vries  <tom@codesourcery.com>

	PR target/45098
	* cfgloop.h (nb_iterations_upper_bound, nb_iterations_estimate):
	Document changed semantics.
	(max_stmt_executions, max_stmt_executions_int): Declare.
	* tree-data-ref.c (estimated_loop_iterations)
	(estimated_loop_iterations_int): Move functions...
	* tree-ssa-loop-niter.c (estimated_loop_iterations)
	(estimated_loop_iterations_int): here.
	(record_estimate): Change nb_iterations_upper_bound and
	nb_iterations_estimate semantics.
	(max_stmt_executions, max_stmt_executions_int): New function.
	* tree-data-ref.c (estimated_loop_iterations_tree): Rename to ...
	(max_stmt_executions_tree): this.
	(analyze_miv_subscript): Use max_stmt_executions_tree instead of
	estimated_loop_iterations_tree.
	tree-ssa-loop-ivopts.c (avg_loop_niter): Use
	max_stmt_executions_int instead of estimated_loop_iterations_int.
	* predict.c (predict_loops): Idem.
	* tree-parloops.c (parallelize_loops): Idem.
	* tree-data-ref.c (analyze_siv_subscript_cst_affine)
	(compute_overlap_steps_for_affine_1_2, analyze_subscript_affine_affine)
	(init_omega_for_ddr_1): Idem.
	* tree-ssa-loop-prefetch.c (determine_loop_nest_reuse)
	(loop_prefetch_arrays): Idem
	* graphite-sese-to-poly.c (build_loop_iteration_domains): Use
	max_stmt_executions instead of estimated_loop_iterations.
	* tree-data-ref.c (estimated_loop_iterations_tree): Idem.
	* tree-vrp.c (adjust_range_with_scev): Use estimated_loop_iterations
	instead of nb_iterations_upper_bound.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr45098-nb_iterations_upper_bound.7.patch
Type: text/x-patch
Size: 17283 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110611/baa5c962/attachment.bin>


More information about the Gcc-patches mailing list