https://github.com/arsenm commented: I think the core change looks better now, but I don't understand the other pieces and they should be spilt out. This patch should not be touching the dominator tree https://github.com/llvm/llvm-project/pull/174746