This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Use single-threaded mode when -matomics isn't enabled.
ClosedPublic

Authored by sunfish on Feb 4 2021, 4:16 PM.

Details

Summary

When the -matomics feature is not enabled, disable POSIXThreads
mode and set the thread model to Single, so that we don't predefine
macros like __STDCPP_THREADS__.

This will help save code size (a thing I care about!) in programs which
use __STDCPP_THREADS__ to determine whether to include support
for threads.

Diff Detail

Event Timeline

sunfish created this revision.Feb 4 2021, 4:16 PM
sunfish requested review of this revision.Feb 4 2021, 4:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 4 2021, 4:16 PM
tlively accepted this revision.Feb 4 2021, 4:33 PM

LGTM, thanks!

This revision is now accepted and ready to land.Feb 4 2021, 4:33 PM
This revision was landed with ongoing or failed builds.Feb 4 2021, 6:17 PM
This revision was automatically updated to reflect the committed changes.
sbc100 added inline comments.Feb 4 2021, 6:53 PM
clang/lib/Basic/Targets/WebAssembly.cpp
260

POSIXThreads already defaults to false I think. It gets set if the user specified -pthread on the command line I think. I think there should be no need to override it.