From b1800240be4dfcd40f749a3e32cd45e52896e22d Mon Sep 17 00:00:00 2001 From: wanglei Date: Sat, 7 Jan 2023 15:22:47 +0800 Subject: [PATCH] [LoongArch] Reorder code and inline variable in lowerGlobalTLSAddress for clarity. NFC --- llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp index b5e5374..afdc6d1 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(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(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 -- 2.7.4