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: Richard Biener <richard dot guenther at gmail dot com>
- To: Bin Cheng <Bin dot Cheng at arm dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>
- Date: Thu, 28 Apr 2016 11:18:38 +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>
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.
Thanks,
Richard.
> Thanks,
> bin
>
> 2016-04-26 Bin Cheng <bin.cheng@arm.com>
>
> PR tree-optimization/56541
> * 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-26 Bin Cheng <bin.cheng@arm.com>
>
> PR tree-optimization/56541
> * gcc.dg/tree-ssa/ifc-pr56541.c: New test.