[llvm] b180024 - [LoongArch] Reorder code and inline variable in lowerGlobalTLSAddress for clarity. NFC

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 23:27:37 PST 2023


Author: wanglei
Date: 2023-01-07T15:26:39+08:00
New Revision: b1800240be4dfcd40f749a3e32cd45e52896e22d

URL: https://github.com/llvm/llvm-project/commit/b1800240be4dfcd40f749a3e32cd45e52896e22d
DIFF: https://github.com/llvm/llvm-project/commit/b1800240be4dfcd40f749a3e32cd45e52896e22d.diff

LOG: [LoongArch] Reorder code and inline variable in lowerGlobalTLSAddress for clarity. NFC

Added: 
    

Modified: 
    llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
index b5e5374a5e76b..afdc6d1bd43b0 100644
--- a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
@@ -550,17 +550,15 @@ SDValue LoongArchTargetLowering::getDynamicTLSAddr(GlobalAddressSDNode *N,
 SDValue
 LoongArchTargetLowering::lowerGlobalTLSAddress(SDValue Op,
                                                SelectionDAG &DAG) const {
-  GlobalAddressSDNode *N = cast<GlobalAddressSDNode>(Op);
-  assert(N->getOffset() == 0 && "unexpected offset in global node");
-
-  SDValue Addr;
-  TLSModel::Model Model = getTargetMachine().getTLSModel(N->getGlobal());
-
   if (DAG.getMachineFunction().getFunction().getCallingConv() ==
       CallingConv::GHC)
     report_fatal_error("In GHC calling convention TLS is not supported");
 
-  switch (Model) {
+  GlobalAddressSDNode *N = cast<GlobalAddressSDNode>(Op);
+  assert(N->getOffset() == 0 && "unexpected offset in global node");
+
+  SDValue Addr;
+  switch (getTargetMachine().getTLSModel(N->getGlobal())) {
   case TLSModel::GeneralDynamic:
     // In this model, application code calls the dynamic linker function
     // __tls_get_addr to locate TLS offsets into the dynamic thread vector at


        


More information about the llvm-commits mailing list