Optimise atomicModifyIORef' implementation (#8345)

This forces the new value before installing it in the IORef.

This optimisation was originally suggested by Patrick Palka
and "exhibits a speedup of 1.7x (vanilla RTS) / 1.4x (threaded RTS)"
according to #8345

Reviewed By: austin, simonmar

Differential Revision: https://phabricator.haskell.org/D315