On Fri, Jan 27, 2017 at 01:15:27PM +0100, Richard Biener wrote: > As both SQRT and DIV may trap I wonder how we can end up speculating > them at all?
The testcase uses -ffast-math. > Ok, maybe with -fno-trapping-math we don't consider that case but even > then generating > a NaN is usually dreadfully slow so avoiding speculation of such insns > looks good in > any case (w/o considering its cost). And -ffast-math includes -ffinite-math-only. No, the testcase never takes the square root of number smaller than zero, it isn't *that* slow ;-) Things slow down so much because there is a loop immediately followed by a square root insn, and sched-rgn decides it is a good idea to move it to inside the loop. Which is a bad idea no matter what the frequency of the loop is because 1) we do not get such profiles very correct, and 2) sqrt is really expensive. Segher