[lld] r336118 - [WebAssembly] Set threadmodel during LTO
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 2 09:27:50 PDT 2018
Author: sbc
Date: Mon Jul 2 09:27:50 2018
New Revision: 336118
URL: http://llvm.org/viewvc/llvm-project?rev=336118&view=rev
Log:
[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
Added:
lld/trunk/test/wasm/lto/atomics.ll
Modified:
lld/trunk/wasm/LTO.cpp
Added: lld/trunk/test/wasm/lto/atomics.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/lto/atomics.ll?rev=336118&view=auto
==============================================================================
--- lld/trunk/test/wasm/lto/atomics.ll (added)
+++ lld/trunk/test/wasm/lto/atomics.ll Mon Jul 2 09:27:50 2018
@@ -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"
+
+ at foo = hidden global i32 1
+
+define void @_start() {
+ %1 = load atomic i32, i32* @foo unordered, align 4
+ ret void
+}
Modified: lld/trunk/wasm/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/LTO.cpp?rev=336118&r1=336117&r2=336118&view=diff
==============================================================================
--- lld/trunk/wasm/LTO.cpp (original)
+++ lld/trunk/wasm/LTO.cpp Mon Jul 2 09:27:50 2018
@@ -45,10 +45,13 @@ static std::unique_ptr<lto::LTO> createL
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;
More information about the llvm-commits
mailing list