a pipeline flush
You guessed the navigator would say 'go straight,' so you drove ahead — and then it said 'turn left.' Now everything you did on the wrong road must be undone, and you start fresh from the fork. A pipeline flush is that undo: when the machine discovers it has been working on the wrong instructions — most often after a mispredicted branch — it discards them from the pipeline before they can do any lasting harm, and restarts fetching from the correct address.
Flushing relies on a key fact: the wrong-path instructions, though fetched and partly processed, have not yet committed — they have not written their results to any register or memory that the program can observe. So the hardware can safely cancel them by converting them into bubbles: their control signals are forced to 'do nothing,' wiping out the writes they were about to make, and the program counter is redirected to the correct target. The deeper into the pipeline the wrong instructions had travelled, the more of them must be flushed — which is precisely why a misprediction in a deep pipeline costs more than in a shallow one.
Flushes are the cost side of speculation. Branch prediction lets the machine charge ahead down a guessed path and is right the vast majority of the time; but on the rare wrong guess, the flush throws away all the speculative work and the pipeline must refill from scratch, costing a number of cycles equal to how far the wrong path got. This is the honest tax on every speculative feature, and it is why a higher misprediction rate or a deeper pipeline directly raises the effective cycles-per-instruction. Crucially, a flush only ever costs time, never correctness — flushed instructions vanish as if they never ran.
A predictor guesses a branch is not taken and fetches the next two instructions; the branch resolves taken. The machine flushes those two by turning them into bubbles, redirects the program counter to the branch target, and refetches — a misprediction penalty of two cycles in this short pipe (far more in a deep one).
A flush discards uncommitted wrong-path instructions after a misprediction and refetches from the correct target — costing cycles, never correctness.
A flush is safe precisely because speculative instructions have not committed. This is also the security wrinkle behind Spectre and Meltdown: flushed instructions leave no architectural trace, but their micro-architectural side effects (cache state) can leak — a performance feature turned attack surface.