On Mon, Sep 12, 2016 at 8:58 PM, Jeff Law wrote: > On 09/06/2016 12:54 PM, Bin Cheng wrote: >> >> Hi, >> LOOP_VINFO_NITERS is computed as LOOP_VINFO_NITERSM1 + 1, which could >> overflow in loop niters' type. Vectorizer needs to generate more code >> computing vectorized niters if overflow does happen. However, For common >> loops, there is no overflow actually, this patch tries to prove the >> no-overflow information and use that to improve code generation. At the >> moment, no-overflow information comes either from loop niter analysis, or >> the truth that we know loop is peeled for non-zero iterations in prologue >> peeling. For the latter case, it doesn't matter if the original >> LOOP_VINFO_NITERS overflows or not, because computation LOOP_VINFO_NITERS - >> LOOP_VINFO_PEELING_FOR_ALIGNMENT cancels the overflow by underflow. >> >> Thanks, >> bin >> >> 2016-09-01 Bin Cheng >> >> * tree-vect-loop.c (loop_niters_no_overflow): New func. >> (vect_transform_loop): Call loop_niters_no_overflow. Pass the >> no-overflow information to vect_do_peeling_for_loop_bound and >> vect_gen_vector_loop_niters. >> > OK when prereqs are all approved. Hi, I revised this patch using widest_int comparison for trees, rather than int. Attached new patch is committed. Also committed all patches in peel refactoring patch set, they are posted at: https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00326.html https://gcc.gnu.org/ml/gcc-patches/2016-10/msg01012.html https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00328.html https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00329.html https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00330.html https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00331.html https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00332.html https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00333.html The patch set bootstrap and test again on x86_64 and AArch64. No regression found. I will keep eyes on possible fallouts. Thanks, bin > > jeff