[PATCH PR77503]Record reduction code for CONST_COND_REDUCTION at analysis stage and use it at transform

Bin Cheng Bin.Cheng@arm.com
Thu Sep 15 10:29:00 GMT 2016


Hi,
This patch fixes PR77503.  Root cause is loop peeling changes the initial value for reduction PHI node, resulting in different statement for vect_transform_stmt to vect_analyze_stmt.  Similar issue stands for loop control IV, we record the original information in LOOP_PHI_EVOLUTION_BASE_UNCHANGED for that.  This patch follows the same method by recording reduction code for CONST_COND_REDUCTION at analysis stage and use the information at transform stage.  The only difference is we need record it in stmt_vec_info because there might be multiple reductions.  Unfortunately this requires additional memory for each statement, I didn't see easy way out.  Maybe it's possible to improve vectorizer so it caches/reuses information from analysis stage to transform stage?
Bootstrap and test on x86_64 and AArch64 ongoing.  Is it OK if no regression?

Thanks,
bin

2016-09-07  Bin Cheng  <bin.cheng@arm.com>

	PR tree-optimization/77503
	* tree-vect-loop.c (vectorizable_reduction): Record reduction
	code for CONST_COND_REDUCTION at analysis stage and use it at
	transform stage.
	* tree-vectorizer.h (struct _stmt_vec_info): New field.
	(STMT_VINFO_VEC_CONST_COND_REDUC_CODE): New macro.
	* tree-vect-stmts.c (new_stmt_vec_info): Initialize above new
	field.

gcc/testsuite/ChangeLog
2016-09-07  Bin Cheng  <bin.cheng@arm.com>

	PR tree-optimization/77503
	* gcc.dg/vect/pr77503.c: New test.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr77503-20160907.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160915/3705809c/attachment.txt>


More information about the Gcc-patches mailing list