Hi, After fixing PR79347, the main problem with vectorizer is we scale down profiling counters for vect_loop by VF, regardless of context CFG's profiling information. This is wrong and sometimes makes vect_loop not hot code, which may confuses following optimizers. This patch generates well-formed profiling information as generic tree unroller does. It borrows code from tree-ssa-loop-manip.c and does small refactors to existing code. Vectorizer will not introduce mismatch counters with it, and unroll and vrp2 are the two major passes messing up profiling counters now. Though it removes all mismatch in vectorizer, I am not sure if this counts as a regression fix. BTW, it may also help PR78116? Hi Pat, could you please help verify this? Thanks! Bootstrap and test on x86_64 and AArch64 ongoing. Is it OK if no failures? Thanks, bin 2017-02-16 Bin Cheng PR tree-optimization/77536 * tree-ssa-loop-manip.c (niter_for_unrolled_loop): New function. (tree_transform_and_unroll_loop): Use above function to compute the estimated niter of unrolled loop. * tree-ssa-loop-manip.h niter_for_unrolled_loop(): New declaration. * tree-vect-loop.c (scale_profile_for_vect_loop): New function. (vect_transform_loop): Call above function. gcc/testsuite/ChangeLog 2017-02-16 Bin Cheng PR tree-optimization/77536 * gcc.dg/vect/pr79347.c: Revise testing string.