While working on D82730 I ran into a case where nearly all compile-time is spent inside the forgetValue() call in rewriteLoopExitValues(). Currently it forgets values eagerly, regardless of whether the phi node will actually get replaced or not. This patch moves the forgetValue() call to just before the phi gets replaced, so we don't waste time forgetting values that don't get changed.
However, this causes a test change in elim-extend.ll. The reason is that an earlier Phi node replacement in IV widening did not perform the forgetValue() call, and as such left behind stale SCEVs (still correct, but possibly sub-accurate). Insert the missing call.