[PATCH] D102527: [RISCV] Add missing emulated TLS support

Brad Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 14 13:14:25 PDT 2021


brad created this revision.
brad added reviewers: craig.topper, frasercrmck.
brad added a project: LLVM.
Herald added subscribers: vkmr, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, krytarowski.
brad requested review of this revision.
Herald added a subscriber: MaskRay.

While getting OpenBSD/riscv64 up and running it was noticed that this bit of code to enable emulated TLS was missing from the RISC-V backend.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102527

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp


Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -2607,6 +2607,10 @@
 
 SDValue RISCVTargetLowering::lowerGlobalTLSAddress(SDValue Op,
                                                    SelectionDAG &DAG) const {
+  const GlobalAddressSDNode *GA = cast<GlobalAddressSDNode>(Op);
+  if (DAG.getTarget().useEmulatedTLS())
+    return LowerToTLSEmulatedModel(GA, DAG);
+
   SDLoc DL(Op);
   EVT Ty = Op.getValueType();
   GlobalAddressSDNode *N = cast<GlobalAddressSDNode>(Op);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102527.345538.patch
Type: text/x-patch
Size: 645 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210514/ee4c416e/attachment.bin>


More information about the llvm-commits mailing list