Richard Biener <rguent...@suse.de> writes: > On Tue, 7 Dec 2021, Andre Vieira (lists) wrote: > >> Hi, >> >> Rebased on top of the epilogue mode patch. >> >> OK for trunk? > > @@ -7242,7 +7315,8 @@ vectorizable_reduction (loop_vec_info loop_vinfo, > participating. */ > if (ncopies > 1 > && (STMT_VINFO_RELEVANT (stmt_info) <= vect_used_only_live) > - && reduc_chain_length == 1) > + && reduc_chain_length == 1 > + && loop_vinfo->suggested_unroll_factor == 1) > single_defuse_cycle = true; > > if (single_defuse_cycle || lane_reduc_code_p) > > It seems to me that 'ncopies' should include > loop_vinfo->suggested_unroll_factor already so the check shouldn't be > necessary.
Yeah, ncopies will be >1 for the unroll case. But the point is that for unrolling, we want each unrolled loop to have its own reduction accumulator, since reducing the aggregate loop-carried latency is one of the main benefits of unrolling a reduction. Thanks, Richard