This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] LTO: Set POSIX thread model when linking with -shared-memoey
AbandonedPublic

Authored by sbc100 on Feb 5 2019, 5:48 PM.

Details

Reviewers
aheejin
dschuff
Summary

This allows LTO to use atomics during codegen.

Event Timeline

sbc100 created this revision.Feb 5 2019, 5:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 5 2019, 5:48 PM

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 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.

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.

aheejin accepted this revision.Feb 7 2019, 2:33 PM

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.

This revision is now accepted and ready to land.Feb 7 2019, 2:33 PM
dschuff accepted this revision.Feb 7 2019, 3:17 PM

Yeah, based on our conversations (e.g. in D57874) we should go ahead with this.

sbc100 updated this revision to Diff 187129.Feb 15 2019, 9:59 PM
  • add test
aheejin added inline comments.Feb 15 2019, 11:39 PM
test/wasm/lto/atomics.ll
4

Can this check if the wasm file contains atomic instructions? There's no CHECK lines for that...

5

Is this llc test relevant to this CL?

11

No need for -wasm?

sbc100 abandoned this revision.Mar 29 2019, 1:23 PM
sbc100 added a subscriber: tlively.

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 ?

Yes, ThreadModel is no longer used anywhere in the WebAssembly backend.