This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Fri, Apr 29, 2016 at 4: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?
And the new ChangeLog entry.

2016-04-28  bin cheng  <bin.cheng@arm.com>

    PR tree-optimization/56541
    * doc/invoke.texi (@item max-tree-if-conversion-phi-args): New item.
    * params.def (PARAM_MAX_TREE_IF_CONVERSION_PHI_ARGS): new param.
    * tree-if-conv.c (MAX_PHI_ARG_NUM): new macro.
    (any_complicated_phi): new static variable.
    (aggressive_if_conv): delete.
    (if_convertible_phi_p): support phis with more than two arguments.
    (if_convertible_bb_p): remvoe check on aggressive_if_conv and
    critical pred edges.
    (ifcvt_split_critical_edges): support phis with more than two
    arguments by checking new parameter.  only split critical edges
    if needed.
    (tree_if_conversion): handle simd pragma marked loop using new
    local variable aggressive_if_conv.  check any_complicated_phi.

gcc/testsuite/changelog
2016-04-28  bin cheng  <bin.cheng@arm.com>

    PR tree-optimization/56541
    * gcc.dg/tree-ssa/ifc-pr56541.c: new test.
    * gcc.dg/vect/pr56541.c: new test.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]