Compilers
In compiler optimization for multiprocessing systems, speculative execution involves an idle processor executing code in the next processor block, in case there is no dependency on code that could be running on other processors. The benefit of this scheme is reducing response time for individual processors and the overall system. However, there is a net penalty for the average case, since in the case of a bad bet, the pipelines should be flushed. The compiler is limited in issuing speculative execution instruction, since it requires hardware assistance to buffer the effects of speculatively-executed instructions. Without hardware support, the compiler could only issue speculative instructions which have no side effects in case of wrong speculation.
Read more about this topic: Speculative Execution