http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54919
--- Comment #2 from Steven Bosscher <steven at gcc dot gnu.org> 2012-10-13 16:38:14 UTC --- At the ".178r.loop2_invariant" dump: 5 r61:SI=0x40 # 64 6 r62:DF=[`*.LC0'] # 0.0 34 r68:DF=[`*.LC1'] # 1.0e+0 L16: 11 r62:DF=r62:DF-r68:DF 12 {r61:SI=r61:SI-0x1;clobber flags:CC;} 13 flags:CCZ=cmp(r61:SI,0) 14 pc={(flags:CCZ==0)?L19:pc} # {implicit: pc=L16} L19: 21 r67:SI=fix(r62:DF) 26 ax:SI=r67:SI 29 use ax:SI Clearly the above loop iterates 64 times. But in the next pass (".180r.loop2_unroll") the iterations estimate is not 64: ;; *** Considering loop 1 for complete peeling *** ;; Considering peeling once rolling loop ... Loop 1 is simple: simple exit 3 -> 5 number of iterations: (const_int 63 [0x3f]) upper bound: 63 realistic bound: 63 ;; Unable to prove that the loop rolls exactly once ;; Considering peeling completely ;; Not peeling loop completely, rolls too much (63 iterations > 16 [maximum peelings]) ;; *** Considering loop 1 *** ;; Considering unrolling loop with constant number of iterations ;; max_unroll 8 (8 copies, initial 8). ;; Decided to unroll the constant times rolling loop, 7 times. But with the wrong iteration estimate, the unrolled loop size is wrong.