This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Enhance ifcombine to recover non short circuit branches
- From: Zhenqiang Chen <zhenqiang dot chen at linaro dot org>
- To: Jeff Law <law at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Andrew Pinski <pinskia at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 18 Oct 2013 17:21:16 +0800
- Subject: Re: [PATCH] Enhance ifcombine to recover non short circuit branches
- Authentication-results: sourceware.org; auth=none
- References: <CACgzC7AbQLh+uv=vzC51DiHjZZn12yEjvtrcyo61z7KjeYCe7Q at mail dot gmail dot com> <CA+=Sn1mm+3Zv9HxgGt4T_utu+-nsvhhCWRF-aWk05K=_704LRw at mail dot gmail dot com> <CAFiYyc2AgJg2r6mzQ69gYo2chBSRFgdVSkSnFU_tQXEanU+NGQ at mail dot gmail dot com> <52601731 dot 3000301 at redhat dot com>
On 18 October 2013 00:58, Jeff Law <law@redhat.com> wrote:
> On 10/17/13 05:03, Richard Biener wrote:
>>>>
>>>> Is it OK for trunk?
>>>
>>>
>>> I had a much simpler change which did basically the same from 4.7 (I
>>> can update it if people think this is a better approach).
>>
>>
>> I like that more (note you can now use is_gimple_condexpr as predicate
>> for force_gimple_operand).
>
> The obvious question is whether or not Andrew's simpler change picks up as
> many transformations as Zhenqiang's change. If not are the things missed
> important.
>
> Zhenqiang, can you do some testing of your change vs Andrew P.'s change?
Here is a rough compare:
1) Andrew P.'s change can not handle ssa-ifcombine-ccmp-3.c (included
in my patch). Root cause is that it does not skip "LABEL". The guard
to do this opt should be the same the bb_has_overhead_p in my patch.
2) Andrew P.'s change always generate TRUTH_AND_EXPR, which is not
efficient for "||". e.g. For ssa-ifcombine-ccmp-6.c, it will generate
_3 = a_2(D) > 0;
_5 = b_4(D) > 0;
_6 = _3 | _5;
_9 = c_7(D) <= 0;
_10 = ~_6;
_11 = _9 & _10;
if (_11 == 0)
With my patch, it will generate
_3 = a_2(D) > 0;
_5 = b_4(D) > 0;
_6 = _3 | _5;
_9 = c_7(D) > 0;
_10 = _6 | _9;
if (_10 != 0)
3) The good thing of Andrew P.'s change is that "Inverse the order of
the basic block walk" so it can do combine recursively.
But I think we need some heuristic to control the number of ifs. Move
too much compares from
the inner_bb to outer_bb is not good.
4) Another good thing of Andrew P.'s change is that it reuses some
existing functions. So it looks much simple.
>>
>> With that we should be able to kill the fold-const.c transform?
>
> That would certainly be nice and an excellent follow-up for Zhenqiang.
That's my final goal to "kill the fold-const.c transform". I think we
may combine the two changes to make a "simple" and "good" patch.
Thanks!
-Zhenqiang