[PATCH GCC]Do more tree if-conversions by handlding PHIs with more than two arguments.

Bin.Cheng amker.cheng@gmail.com
Tue May 10 14:03:00 GMT 2016


On Tue, May 10, 2016 at 3:00 PM, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
> On 3 May 2016 at 11:07, Bin.Cheng <amker.cheng@gmail.com> wrote:
>> On Mon, May 2, 2016 at 10:02 AM, Richard Biener
>> <richard.guenther@gmail.com> wrote:
>>> On Fri, Apr 29, 2016 at 5:51 PM, Bin.Cheng <amker.cheng@gmail.com> wrote:
>>>> On Thu, Apr 28, 2016 at 10:18 AM, Richard Biener
>>>> <richard.guenther@gmail.com> wrote:
>>>>> On Wed, Apr 27, 2016 at 5:49 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
>>>>>> Hi,
>>>>>> Currently tree if-conversion only supports PHIs with no more than two arguments unless the loop is marked with "simd pragma".  This patch makes such PHIs supported unconditionally if they have no more than MAX_PHI_ARG_NUM arguments, thus cases like PR56541 can be fixed.  Note because a chain of "?:" operators are needed to compute mult-arg PHI, this patch records the case and versions loop so that vectorizer can fall back to the original loop if if-conversion+vectorization isn't beneficial.  Ideally, cost computation in vectorizer should be improved to measure benefit against the original loop, rather than if-converted loop.  So far MAX_PHI_ARG_NUM is set to (4) because cases with more arguments are rare and not likely beneficial.
>>>>>>
>>>>>> Apart from above change, the patch also makes changes like: only split critical edge when we have to; cleanups code logic in if_convertible_loop_p about aggressive_if_conv.
>>>>>>
>>>>>> Bootstrap and test on x86_64 and AArch64, is it OK?
>>>>>
>>>>> Can you make this magic number a --param please?  Otherwise ok.
>>>> Hi,
>>>> Here is the updated patch.  I also added a vectorization test case
>>>> since PR56541 was reported against it.
>>>> Bootstrap & test on x86_64, is it OK?
>>>
>>> +/* { dg-options "-O3 -fdump-tree-ifcvt-stats" { target *-*-* } } */
>>>
>>> you can omit { target *-*-* } here.
>>>
>>> Ok with that change.
>>>
>> Patch applied as suggested at r235808.
>>
>
> Hi Bin,
>
> I'm seeing:
> FAIL: gcc.dg/vect/pr56541.c -flto -ffat-lto-objects
> scan-tree-dump-times vect "vectorized 1 loops" 1
> FAIL: gcc.dg/vect/pr56541.c scan-tree-dump-times vect "vectorized 1 loops" 1
Hi,
Thanks for reporting this, I remembered it passes on AArch64 when the
patch is tested.  I will look into it.

Thanks,
bin
>
> on arm and aarch64 targets.
>
> Didn't you see this in your aarch64 bootstrap?
>
> Christophe.
>
>
>> Thanks,
>> bin



More information about the Gcc-patches mailing list