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]

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


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?

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.

Attachment: pr56541-20160424.txt
Description: pr56541-20160424.txt


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