[PATCH] D88323: [WebAssembly] Check features before making SjLj vars thread-local

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 10:55:47 PDT 2020


tlively created this revision.
tlively added reviewers: aheejin, dschuff, sbc100.
Herald added subscribers: llvm-commits, ecnelises, jfb, sunfish, hiraditya, jgravelle-google.
Herald added a project: LLVM.
tlively requested review of this revision.

1c5a3c4d3823 <https://reviews.llvm.org/rG1c5a3c4d382353e582ecf4913e338599028e267f> updated the variables inserted by Emscripten SjLj lowering to be
thread-local, depending on the CoalesceFeaturesAndStripAtomics pass to downgrade
them to normal globals if the target features did not support TLS. However, this
had the unintended side effect of preventing all non-TLS-supporting objects from
being linked into modules with shared memory, because stripping TLS marks an
object as thread-unsafe. This patch fixes the problem by only making the SjLj
lowering variables thread-local if the target machine supports TLS so that it
never introduces new usage of TLS that will be stripped. Since SjLj lowering
works on Modules instead of Functions, this required that the
WebAssemblyTargetMachine have its feature string updated to reflect the
coalesced features collected from all the functions so that a
WebAssemblySubtarget can be created without using any particular function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88323

Files:
  llvm/include/llvm/Target/TargetMachine.h
  llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.h
  llvm/test/CodeGen/WebAssembly/lower-em-exceptions.ll
  llvm/test/CodeGen/WebAssembly/lower-em-sjlj.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88323.294366.patch
Type: text/x-patch
Size: 7574 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200925/b20deb96/attachment.bin>


More information about the llvm-commits mailing list