simplify this logic a bit more.
authorChris Lattner <sabre@nondot.org>
Thu, 9 Jul 2009 07:02:30 +0000 (07:02 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 9 Jul 2009 07:02:30 +0000 (07:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75118 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index bb5829ac612dde5c523c2edc660b96a07acea1fa..b04d372ed99ac503ebcd3433d242b3439f38e6ca 100644 (file)
@@ -4582,18 +4582,14 @@ X86TargetLowering::LowerGlobalAddress(const GlobalValue *GV, DebugLoc dl,
       
       // Link-once, declaration, or Weakly-linked global variables need
       // non-lazily-resolved stubs.
-      if (!GV->isDeclaration() && !GV->isWeakForLinker()) {
+      if (!ExtraLoadRequired) {
         // Not a stub reference.
         OpFlags = IsPIC ? X86II::MO_PIC_BASE_OFFSET : 0;
       } else if (!GV->hasHiddenVisibility()) {
         // Non-hidden $non_lazy_ptr reference.
         OpFlags = IsPIC ? X86II::MO_DARWIN_NONLAZY_PIC_BASE :
                           X86II::MO_DARWIN_NONLAZY;
-      } else if (!GV->isDeclaration() && !GV->hasCommonLinkage())
-        // Definition is definitely in the current linkage unit.
-        // Not a stub reference.
-        OpFlags = IsPIC ? X86II::MO_PIC_BASE_OFFSET : 0;
-      else {
+      } else {
         // Hidden $non_lazy_ptr reference.
         OpFlags = IsPIC ? X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE :
                           X86II::MO_DARWIN_HIDDEN_NONLAZY;