The branch that is guessed to be the most likely is then fetched and speculatively executed. If it is later detected that the guess was wrong then the speculatively executed or partially executed instructions are discarded and the pipeline starts over with the correct branch, incurring a delay.
The citation comes from wikipedia.
Why is it possible to always discard executed instructions? For example, what about a situation where the first instruction in mispredicted taken branch is syscall 0x60
( on Linux it is interruption: "Exit program" ). I know that the program won't be exited in case of misprediction but how the CPU is able to discard?
I know that every instruction ( splitted to micro-ops) must be retired to be finished. Maybe it is important for speculative execution?