diff options
author | Sam Clegg <sbc@chromium.org> | 2018-07-02 16:27:50 +0000 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2018-07-02 16:27:50 +0000 |
commit | 92c10492de1a65a37f7e4cb95d7e50dc522766ae (patch) | |
tree | f43571d424a42ed5ce6f0e457753970b3e1cc4ae | |
parent | 198f3b16dc3dc6370cdc7d1c656efbdd7b90123d (diff) | |
download | bcm5719-llvm-92c10492de1a65a37f7e4cb95d7e50dc522766ae.tar.gz bcm5719-llvm-92c10492de1a65a37f7e4cb95d7e50dc522766ae.zip |
[WebAssembly] Set threadmodel during LTO
Subscribers: dschuff, mehdi_amini, inglorion, jgravelle-google, aheejin, sunfish, steven_wu, llvm-commits
Differential Revision: https://reviews.llvm.org/D48689
llvm-svn: 336118
-rw-r--r-- | lld/test/wasm/lto/atomics.ll | 14 | ||||
-rw-r--r-- | lld/wasm/LTO.cpp | 5 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lld/test/wasm/lto/atomics.ll b/lld/test/wasm/lto/atomics.ll new file mode 100644 index 00000000000..a5a82ae2a5f --- /dev/null +++ b/lld/test/wasm/lto/atomics.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as %s -o %t.o +; RUN: wasm-ld %t.o -o %t.wasm -lto-O0 +; Atomic operations with fail to compile if the ThreadModel is not +; correctly set to Single (i.e. if atomics are not lowered to regular ops). + +target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" +target triple = "wasm32-unknown-unknown-wasm" + +@foo = hidden global i32 1 + +define void @_start() { + %1 = load atomic i32, i32* @foo unordered, align 4 + ret void +} diff --git a/lld/wasm/LTO.cpp b/lld/wasm/LTO.cpp index dd66c67e39f..f15551da8b8 100644 --- a/lld/wasm/LTO.cpp +++ b/lld/wasm/LTO.cpp @@ -45,10 +45,13 @@ static std::unique_ptr<lto::LTO> createLTO() { lto::Config C; C.Options = InitTargetOptionsFromCodeGenFlags(); - // Always emit a section per function/datum with LTO. + // Always emit a section per function/data with LTO. C.Options.FunctionSections = true; C.Options.DataSections = true; + // Wasm currently only supports ThreadModel::Single + C.Options.ThreadModel = ThreadModel::Single; + C.DisableVerify = Config->DisableVerify; C.DiagHandler = diagnosticHandler; C.OptLevel = Config->LTOO; |