[llvm-branch-commits] [llvm] 18ce612 - Use PC-relative address for x32 TLS address

Harald van Dijk via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 2 14:25:07 PST 2020


Author: H.J. Lu
Date: 2020-12-02T22:20:36Z
New Revision: 18ce612353795da6838aade2b933503cbe3cf9b9

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

LOG: Use PC-relative address for x32 TLS address

Since x32 supports PC-relative address, it shouldn't use EBX for TLS
address.  Instead of checking N.getValueType(), we should check
Subtarget->is32Bit().  This fixes PR 22676.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D16474

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelDAGToDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 9a16dc17ba61..de8c2f345fb5 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -2694,12 +2694,12 @@ bool X86DAGToDAGISel::selectTLSADDRAddr(SDValue N, SDValue &Base,
   AM.Disp += GA->getOffset();
   AM.SymbolFlags = GA->getTargetFlags();
 
-  MVT VT = N.getSimpleValueType();
-  if (VT == MVT::i32) {
+  if (Subtarget->is32Bit()) {
     AM.Scale = 1;
     AM.IndexReg = CurDAG->getRegister(X86::EBX, MVT::i32);
   }
 
+  MVT VT = N.getSimpleValueType();
   getAddressOperands(AM, SDLoc(N), VT, Base, Scale, Index, Disp, Segment);
   return true;
 }


        


More information about the llvm-branch-commits mailing list