This allows LTO to use atomics during codegen.
I think we should change the logic in the backend to use the atomics target feature rather than the thread model to determine whether to run the LowerAtomics pass. Then this won't be necessary since the functions will have the appropriate attribute.
Still working on a test case..
I agree in the long term that make sense, but for now I'd like to match clang. Currently the clang wasm toolchain has WebAssembly::getThreadModel() which specific "single" by default. Once we remove that then we can also remove this patch and possible completely from the ThreadModel LTO option.
I don't think we can remove the threadmodel thing from the backend in near future (because atomics is a subtarget feature), so I suggest landing this because without this LTO wouldn't work.