vzakhari wrote: Given that LLVM's `gvn-hoist` is doing the same transformation, I would recommend adding an extra option to the CSE pass that would enable such hoisting in top of the current CSE logic. https://github.com/llvm/llvm-project/pull/180556