This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR60505
- From: Cong Hou <congh at google dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: Jakub Jelinek <jakub at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 14 Mar 2014 17:27:20 -0700
- Subject: Re: [PATCH] Fix PR60505
- Authentication-results: sourceware.org; auth=none
- References: <CAK=A3=1eySj3DAFV+3=GSD6y9KxnMQ6SKUW9s43cybRN7PeBiw at mail dot gmail dot com> <20140312082459 dot GI22862 at tucnak dot redhat dot com> <CAK=A3=1-0dXNYxesV7KhOsR84vpR-DkTfNkeKcD2xf7LpOL0xw at mail dot gmail dot com> <alpine dot LSU dot 2 dot 11 dot 1403131026520 dot 6041 at zhemvz dot fhfr dot qr> <CAK=A3=38Kh0pb9EKsCoJkR0FyuX=p7rHW0_MrvCDFzapPo97HA at mail dot gmail dot com> <alpine dot LSU dot 2 dot 11 dot 1403140850170 dot 6041 at zhemvz dot fhfr dot qr> <20140314075734 dot GC22862 at tucnak dot redhat dot com> <alpine dot LSU dot 2 dot 11 dot 1403140857110 dot 6041 at zhemvz dot fhfr dot qr>
On Fri, Mar 14, 2014 at 12:58 AM, Richard Biener <rguenther@suse.de> wrote:
> On Fri, 14 Mar 2014, Jakub Jelinek wrote:
>
>> On Fri, Mar 14, 2014 at 08:52:07AM +0100, Richard Biener wrote:
>> > > Consider this fact and if there are alias checks, we can safely remove
>> > > the epilogue if the maximum trip count of the loop is less than or
>> > > equal to the calculated threshold.
>> >
>> > You have to consider n % vf != 0, so an argument on only maximum
>> > trip count or threshold cannot work.
>>
>> Well, if you only check if maximum trip count is <= vf and you know
>> that for n < vf the vectorized loop + it's epilogue path will not be taken,
>> then perhaps you could, but it is a very special case.
>> Now, the question is when we are guaranteed we enter the scalar versioned
>> loop instead for n < vf, is that in case of versioning for alias or
>> versioning for alignment?
>
> I think neither - I have plans to do the cost model check together
> with the versioning condition but didn't get around to implement that.
> That would allow stronger max bounds for the epilogue loop.
In vect_transform_loop(), check_profitability will be set to true if
th >= VF-1 and the number of iteration is unknown (we only consider
unknown trip count here), where th is calculated based on the
parameter PARAM_MIN_VECT_LOOP_BOUND and cost model, with the minimum
value VF-1. If the loop needs to be versioned, then
check_profitability with true value will be passed to
vect_loop_versioning(), in which an enhanced loop bound check
(considering cost) will be built. So I think if the loop is versioned
and n < VF, then we must enter the scalar version, and in this case
removing epilogue should be safe when the maximum trip count <= th+1.
thanks,
Cong
>
> Richard.