This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH GCC]Do more tree if-conversions by handlding PHIs with more than two arguments.
- From: Christophe Lyon <christophe dot lyon at linaro dot org>
- To: "Bin.Cheng" <amker dot cheng at gmail dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 10 May 2016 16:00:13 +0200
- Subject: Re: [PATCH GCC]Do more tree if-conversions by handlding PHIs with more than two arguments.
- Authentication-results: sourceware.org; auth=none
- References: <DB5PR08MB11440BD3AE1D931E5A922969E7640 at DB5PR08MB1144 dot eurprd08 dot prod dot outlook dot com> <CAFiYyc3QKLL2JzW4U53D9OnBUsmpQ2Rr9coMWo60s2qN6gGc8Q at mail dot gmail dot com> <CAHFci2-ff5R5dgLcs_i7absLi7cwshA19bjeusf_7VOXZkmavQ at mail dot gmail dot com> <CAFiYyc19iri5T50hqcuKjaSTfLrMEkD7u9=VAc4zUvKmCXdoqQ at mail dot gmail dot com> <CAHFci29h_8DC8pO=tNZfr9oQJ9m8xSyNNQrYU2x6g=7mKcGyoQ at mail dot gmail dot com>
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
on arm and aarch64 targets.
Didn't you see this in your aarch64 bootstrap?
Christophe.
> Thanks,
> bin