For example, in Haskell you can freely rewrite common subexpression with a let whenever you want and in whatever order you want.
--original
(f x) ... (f x)
--let
let y = f x in y ... y
On the other hand, if your language has side effects these sort of transformations are not always safe.