https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68664
--- Comment #15 from James Greenhalgh <jgreenhalgh at gcc dot gnu.org> --- (In reply to Segher Boessenkool from comment #14) > I'm not sure how to read your remark. An insn where the result is > not used is not on the critical path by definition; and you seem to > be arguing for -fno-sched-spec by default? For cores with in-order execution, a long-running instruction like a square-root stalls execution until it completes. Even as you move to partially out-of-order and fully out-of-order execution the cost of executing a useless instruction is increased demand for limited system resources. For example, even an insn with an unused result can prevent retire of subsequent instructions until it completes, and at the very least it holds sqrt/divide resource. Modelling this resource usage in terms of unit reservations increases the size of the automaton in a way that quickly makes it unfeasible (see pr70473 and pr60743 for recent ARM examples). "Latency" may not be a great name for the cost we're looking for, but it is a reasonable approximation. If an instruction causes significant resource usage we ought not to make it speculative. That isn't an argument for -fno-sched-spec, it is an argument for a cost model which better matches the cost of the transformation, using the information available, without bloating the automaton.