Optimize PIC implementation. GOTOFF can be used when the symbol is defined
authorLauro Ramos Venancio <lauro.venancio@gmail.com>
Mon, 14 May 2007 18:46:23 +0000 (18:46 +0000)
committerLauro Ramos Venancio <lauro.venancio@gmail.com>
Mon, 14 May 2007 18:46:23 +0000 (18:46 +0000)
and used in the same module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37044 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMISelLowering.cpp

index 34ea98c0b9475436032a07cd2570ce2e71b21687..30b2a94bb0d0b6d4d0f8c945133665bc849e9874 100644 (file)
@@ -792,7 +792,7 @@ SDOperand ARMTargetLowering::LowerGlobalAddressELF(SDOperand Op,
   GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
   Reloc::Model RelocM = getTargetMachine().getRelocationModel();
   if (RelocM == Reloc::PIC_) {
-    bool UseGOTOFF = GV->hasInternalLinkage();
+    bool UseGOTOFF = !GV->isDeclaration();
     ARMConstantPoolValue *CPV =
       new ARMConstantPoolValue(GV, ARMCP::CPValue, UseGOTOFF ? "GOTOFF":"GOT");
     SDOperand CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 2);