This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH GCC8][31/33]Set range information for niter bound of vectorized loop
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: "Bin.Cheng" <amker dot cheng at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 19 May 2017 14:51:30 +0200
- Subject: Re: [PATCH GCC8][31/33]Set range information for niter bound of vectorized loop
- Authentication-results: sourceware.org; auth=none
- References: <VI1PR0802MB2176DFC4FDDB5C365B2F8E3FE7190@VI1PR0802MB2176.eurprd08.prod.outlook.com> <CAFiYyc3ER4ouUuF5CKWHtDGogvQUOgekY61nz65kuSyOCsD=7g@mail.gmail.com> <CAHFci2-GopkQO8ouwqddrROiFGbMvNYXne=FatLsw+fDFcg1ww@mail.gmail.com>
On Mon, May 15, 2017 at 5:58 PM, Bin.Cheng <amker.cheng@gmail.com> wrote:
> On Thu, May 11, 2017 at 12:02 PM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Tue, Apr 18, 2017 at 12:54 PM, Bin Cheng <Bin.Cheng@arm.com> wrote
>>> Hi,
>>> Based on vect_peeling algorithm, we know for sure that vectorized loop must iterates at least once.
>>> This patch sets range information for niter bounds of vectorized loop. This helps niter analysis,
>>> so iv elimination too.
>>> Is it OK?
>>
>> niters_vector = force_gimple_operand (niters_vector, &stmts, true, var);
>> gsi_insert_seq_on_edge_immediate (pe, stmts);
>> + /* Peeling algorithm guarantees that vector loop bound is at least ONE,
>> + we set range information to make niters analyzer's life easier. */
>> + if (TREE_CODE (niters_vector) == SSA_NAME)
>> + set_range_info (niters_vector, VR_RANGE, build_int_cst (type, 1),
>> + fold_build2 (RSHIFT_EXPR, type,
>> + TYPE_MAX_VALUE (type), log_vf));
>>
>> if all of niters_vector folds to an original SSA name then
>> niters_vector after gimplification
>> is not a new SSA name and thus you can't set range-info on it.
>>
>> Likewise for the other case where LOOP_VINFO_NITERS is just an SSA name.
> Hi,
> This is updated patch. It checks whether the result ssa name is newly
> created tmp and only sets range information if so.
>
> Is it OK?
A better way to check whether the SSA name is new is to see if 'stmts'
filled by force_gimple_operand is non-empty.
Richard.
> Thanks,
> bin
>
> 2017-04-11 Bin Cheng <bin.cheng@arm.com>
>
> * tree-vectorizer.h (vect_build_loop_niters): New parameter.
> * tree-vect-loop-manip.c (vect_build_loop_niters): New parameter.
> Set true to new parameter if new ssa variable is defined.
> (vect_gen_vector_loop_niters): Refactor. Set range information
> for the new vector loop bound variable.
> (vect_do_peeling): Ditto.
>
>>
>> Richard.
>>
>>> Thanks,
>>> bin
>>> 2017-04-11 Bin Cheng <bin.cheng@arm.com>
>>>
>>> * tree-vect-loop-manip.c (vect_gen_vector_loop_niters): Refactor.
>>> Set range information for vector loop bound variable.
>>> (vect_do_peeling): Ditto.