https://github.com/arsenm requested changes to this pull request. This cannot be fixed with an assert. It should be a tested fatal error, and I was hoping we could do this for every pass that requires the TargetMachine https://github.com/llvm/llvm-project/pull/142350