This allows LTO to use atomics during codegen.
Diff Detail
- Repository
- rLLD LLVM Linker
- Build Status
Buildable 28232 Build 28231: arc lint + arc unit
Event Timeline
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.
I believe we can now drop this, and instead remove the setting of C.Options.ThreadModel since the +atomics attribute on the bitcode input should be enough to lower atomics correctly, right @tlively ?
Can this check if the wasm file contains atomic instructions? There's no CHECK lines for that...