This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [autovect] [patch] vectorize in cases when number of iterations may be zero
- From: Victor Kaplansky <VICTORK at il dot ibm dot com>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, pop at cri dot ensmp dot fr, sebpop at gmail dot com
- Date: Thu, 15 Jun 2006 19:50:03 +0300
- Subject: Re: [autovect] [patch] vectorize in cases when number of iterations may be zero
> Why do you create a new wrapper for this, instead of just using
> number_of_iterations_exit directly (which would give you the same
> information)?
Original number_of_iterations_exit called to a static inline function
set_nb_iterations_in_loop () and I prefered not copy it to vectorizer
sources.
>
> This is definitely wrong. expr_invariant_in_loop_p cannot know that the
> decl is not changed in the loop (in fact, if it were not changed in the
> loop, load motion would move it out of the loop before, so you would
> never get it as an argument of expr_invariant_in_loop_p). I also do not
> see why you need this change in the example you mention.
I see. Actually the problem is that expr_invariant_in_loop_p ()
returns 'false' for the initial condition of the following access function:
Access function of ptr: {(short *) &input_buf[(<unnamed type>) lag], +,
2B}_4
where 'buf' is a global array and 'lag' is loop-invriant.
at /home/victork/autovect/gcc/gcc/tree-data-ref.c:1036
1036 if (!expr_invariant_in_loop_p (loop, init))
(gdb) p debug_generic_expr (init)
&input_bufD.1868[(<unnamed type>) lagD.18880_550]
$10 = void
(gdb) p debug_tree (init)
<addr_expr 0xf7f611c0
type <pointer_type 0xf7fb5c30
type <integer_type 0xf7fa4208 e_s16 sizes-gimplified public HI
size <integer_cst 0xf7ee2360 constant invariant 16>
unit size <integer_cst 0xf7ee2380 constant invariant 2>
align 16 symtab 0 alias set -1 precision 16 min <integer_cst
0xf7ee22e0 -32768> max <integer_cst 0xf7ee2320 32767> context
<translation_unit_decl 0xf7ba5a00 D.11557>
pointer_to_this <pointer_type 0xf7fb5c30>>
sizes-gimplified public unsigned SI
size <integer_cst 0xf7ee24a0 constant invariant 32>
unit size <integer_cst 0xf7ee2160 constant invariant 4>
align 32 symtab 0 alias set -1>
arg 0 <array_ref 0xf73d8390 type <integer_type 0xf7fa4208 e_s16>
arg 0 <var_decl 0xf7fc93f0 input_buf type <array_type 0xf7fd1888>
addressable used static BLK file x.c line 201
size <integer_cst 0xf7fad1c0 constant invariant 256>
unit size <integer_cst 0xf7ee2140 constant invariant 32>
align 16 context <translation_unit_decl 0xf7fc1480 D.1929>
initial <constructor 0xf7fcbb88> chain <var_decl 0xf7fc9460 test_buf>>
arg 1 <nop_expr 0xf7f611a0 type <integer_type 0xf7f49dd0>
arg 0 <ssa_name 0xf71cbe00 type <integer_type 0xf7db8bc8 n_int>
visited var <var_decl 0xf73d2a10 lag> def_stmt <phi_node
0xf7dba700>
version 550>>
arg 2 <integer_cst 0xf7ee2180 constant invariant 0>
arg 3 <integer_cst 0xf7ee2220 constant invariant 1>>>
$11 = void
(gdb)
I'll try to reduce a test-case.
-- Victor