[lld] r355112 - [WebAssembly] Remove uses of ThreadModel

Thomas Lively via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 28 10:39:08 PST 2019


Author: tlively
Date: Thu Feb 28 10:39:08 2019
New Revision: 355112

URL: http://llvm.org/viewvc/llvm-project?rev=355112&view=rev
Log:
[WebAssembly] Remove uses of ThreadModel

Summary:
In the clang UI, replaces -mthread-model posix with -matomics as the
source of truth on threading. In the backend, replaces
-thread-model=posix with the atomics target feature, which is now
collected on the WebAssemblyTargetMachine along with all other used
features. These collected features will also be used to emit the
target features section in the future.

The default configuration for the backend is thread-model=posix and no
atomics, which was previously an invalid configuration. This change
makes the default valid because the thread model is ignored.

A side effect of this change is that objects are never emitted with
passive segments. It will instead be up to the linker to decide
whether sections should be active or passive based on whether atomics
are used in the final link.

Reviewers: aheejin, sbc100, dschuff

Subscribers: mehdi_amini, jgravelle-google, hiraditya, sunfish, steven_wu, dexonsmith, rupprecht, jfb, jdoerfert, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D58742

Modified:
    lld/trunk/test/wasm/init-fini.ll
    lld/trunk/test/wasm/lto/atomics.ll
    lld/trunk/wasm/LTO.cpp

Modified: lld/trunk/test/wasm/init-fini.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/init-fini.ll?rev=355112&r1=355111&r2=355112&view=diff
==============================================================================
--- lld/trunk/test/wasm/init-fini.ll (original)
+++ lld/trunk/test/wasm/init-fini.ll Thu Feb 28 10:39:08 2019
@@ -1,5 +1,5 @@
-; RUN: llc -filetype=obj -thread-model=single -o %t.o %s
-; RUN: llc -filetype=obj -thread-model=single %S/Inputs/global-ctor-dtor.ll -o %t.global-ctor-dtor.o
+; RUN: llc -filetype=obj -o %t.o %s
+; RUN: llc -filetype=obj %S/Inputs/global-ctor-dtor.ll -o %t.global-ctor-dtor.o
 
 target triple = "wasm32-unknown-unknown"
 

Modified: lld/trunk/test/wasm/lto/atomics.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/lto/atomics.ll?rev=355112&r1=355111&r2=355112&view=diff
==============================================================================
--- lld/trunk/test/wasm/lto/atomics.ll (original)
+++ lld/trunk/test/wasm/lto/atomics.ll Thu Feb 28 10:39:08 2019
@@ -1,7 +1,8 @@
 ; 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).
+
+; Atomic operations will not fail to compile if atomics are not
+; enabled because LLVM atomics will be lowered to regular ops.
 
 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
 target triple = "wasm32-unknown-unknown-wasm"

Modified: lld/trunk/wasm/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/LTO.cpp?rev=355112&r1=355111&r2=355112&view=diff
==============================================================================
--- lld/trunk/wasm/LTO.cpp (original)
+++ lld/trunk/wasm/LTO.cpp Thu Feb 28 10:39:08 2019
@@ -47,9 +47,6 @@ static std::unique_ptr<lto::LTO> createL
   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