[PATCH] D64949: [WebAssembly] Fix __builtin_wasm_tls_base intrinsic

Guanzhong Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 18 13:46:51 PDT 2019


quantum created this revision.
quantum added reviewers: tlively, aheejin, sbc100, sunfish.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya, jgravelle-google, dschuff.
Herald added projects: clang, LLVM.

Properly generate the outchain for the `__builtin_wasm_tls_base` intrinsic.

Also marked the intrinsic pure, per @sunfish's suggestion.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64949

Files:
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp


Index: llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
@@ -235,7 +235,7 @@
       assert(PtrVT == MVT::i32 && "only wasm32 is supported for now");
 
       MachineSDNode *TLSBase = CurDAG->getMachineNode(
-          WebAssembly::GLOBAL_GET_I32, DL, MVT::i32,
+          WebAssembly::GLOBAL_GET_I32, DL, MVT::i32, MVT::Other,
           CurDAG->getTargetExternalSymbol("__tls_base", PtrVT),
           Node->getOperand(0));
       ReplaceNode(Node, TLSBase);
Index: clang/include/clang/Basic/BuiltinsWebAssembly.def
===================================================================
--- clang/include/clang/Basic/BuiltinsWebAssembly.def
+++ clang/include/clang/Basic/BuiltinsWebAssembly.def
@@ -31,7 +31,7 @@
 
 // Thread-local storage
 TARGET_BUILTIN(__builtin_wasm_tls_size, "z", "nc", "bulk-memory")
-TARGET_BUILTIN(__builtin_wasm_tls_base, "v*", "n", "bulk-memory")
+TARGET_BUILTIN(__builtin_wasm_tls_base, "v*", "nU", "bulk-memory")
 
 // Floating point min/max
 BUILTIN(__builtin_wasm_min_f32, "fff", "nc")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64949.210662.patch
Type: text/x-patch
Size: 1209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190718/81dc20c3/attachment.bin>


More information about the cfe-commits mailing list