https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80197
Uroš Bizjak <ubizjak at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-03-27 CC| |jakub at gcc dot gnu.org, | |rguenth at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> --- For some reason, recently fixed if-conversion (PR79389) does not trigger in PGO case. There is still a jump with -O2: mulsd %xmm0, %xmm5 mulsd %xmm2, %xmm2 addsd %xmm2, %xmm5 ucomisd %xmm5, %xmm4 jb .L17 .L16: addl $1, %ebp .L17: addl $1, %edi cmpl %edi, %ebx je .L5 Since this asm corresponds to random operands, the jump can't be predicted: for (count=0; count<Num_samples; count++) { double x= Random_nextDouble(R); double y= Random_nextDouble(R); if ( x*x + y*y <= 1.0) under_curve ++; } Based on the discussion in PR79389, and the fact that -O2 and -O3 both compile to a jump, I suspect that loop splitting cost model should be fine tuned to also handle PGO case. Note that Adding some CCs.