[PATCH] D48689: [WebAssembly] Set threadmodel during LTO

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 2 09:32:43 PDT 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD336118: [WebAssembly] Set threadmodel during LTO (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D48689?vs=153348&id=153738#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D48689

Files:
  test/wasm/lto/atomics.ll
  wasm/LTO.cpp


Index: wasm/LTO.cpp
===================================================================
--- wasm/LTO.cpp
+++ wasm/LTO.cpp
@@ -45,10 +45,13 @@
   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;
Index: test/wasm/lto/atomics.ll
===================================================================
--- test/wasm/lto/atomics.ll
+++ 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"
+
+ at foo = hidden global i32 1
+
+define void @_start() {
+  %1 = load atomic i32, i32* @foo unordered, align 4
+  ret void
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48689.153738.patch
Type: text/x-patch
Size: 1236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180702/2d489781/attachment.bin>


More information about the llvm-commits mailing list