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 PR77503]Record reduction code for CONST_COND_REDUCTION at analysis stage and use it at transform


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.

Attachment: pr77503-20160907.txt
Description: pr77503-20160907.txt


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