[llvm] r366499 - [WebAssembly] Fix __builtin_wasm_tls_base intrinsic
Guanzhong Chen via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 14:17:52 PDT 2019
Author: quantum
Date: Thu Jul 18 14:17:52 2019
New Revision: 366499
URL: http://llvm.org/viewvc/llvm-project?rev=366499&view=rev
Log:
[WebAssembly] Fix __builtin_wasm_tls_base intrinsic
Summary:
Properly generate the outchain for the `__builtin_wasm_tls_base` intrinsic.
Also marked the intrinsic pure, per @sunfish's suggestion.
Reviewers: tlively, aheejin, sbc100, sunfish
Reviewed By: tlively
Subscribers: dschuff, jgravelle-google, hiraditya, cfe-commits, llvm-commits, sunfish
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D64949
Modified:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
llvm/trunk/test/CodeGen/WebAssembly/tls-general-dynamic.ll
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp?rev=366499&r1=366498&r2=366499&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp Thu Jul 18 14:17:52 2019
@@ -235,7 +235,7 @@ void WebAssemblyDAGToDAGISel::Select(SDN
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);
Modified: llvm/trunk/test/CodeGen/WebAssembly/tls-general-dynamic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/tls-general-dynamic.ll?rev=366499&r1=366498&r2=366499&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/tls-general-dynamic.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/tls-general-dynamic.ll Thu Jul 18 14:17:52 2019
@@ -84,6 +84,17 @@ define i8* @tls_base() {
ret i8* %1
}
+; CHECK-LABEL: tls_base_write:
+; CHECK-NEXT: .functype tls_base_write (i32) -> ()
+define void @tls_base_write(i8** %output) {
+; CHECK-NEXT: global.get __tls_base
+; CHECK-NEXT: i32.store 0
+; CHECK-NEXT: return
+ %1 = call i8* @llvm.wasm.tls.base()
+ store i8* %1, i8** %output
+ ret void
+}
+
; CHECK: .type tls, at object
; TLS-NEXT: .section .tbss.tls,"",@
; NO-TLS-NEXT: .section .bss.tls,"",@
More information about the llvm-commits
mailing list