https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120916
--- Comment #8 from Jan Hubicka <hubicka at gcc dot gnu.org> --- Patching create_gcov to account all of debug statements associated with a given address instead of just the last one gets me: test total:4350509 head:8642 1: 4484 // { 2: 4484 // for ( 3: 4484 // int i = 0; 4: 1444460 // i < s 5: 1444460 // i++) 6: 1444460 // a[i]++ 7: 3677 // } main total:6497 head:0 1: 0 2: 0 2.1: 2105 test:2079 2.3: 2105 test:2079 3: 2287 test:2079 4: 0 which looks better. However I am not sure if I can handle multiple debug statements associated to the same line with different inline stacks, since inline stacks seems to be keyed to locations. I am not sure if auto-profiles have chance to give realistic loop iteration count estimates. Counts suggests 322 iterations, since loop iterates 1023 and is unrolled by factor 4 it is still somewhat off, but at least we get much better profile.