Perform cheap checks first.
authorEvan Cheng <evan.cheng@apple.com>
Mon, 8 Dec 2008 06:52:43 +0000 (06:52 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Mon, 8 Dec 2008 06:52:43 +0000 (06:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60689 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86Subtarget.cpp

index 583fe8a0fbe06732f10f4e3f7349bb3eb046df59..c9d14d3d5d7e88ca4de7a68390c3c041f70cb4ba 100644 (file)
@@ -40,6 +40,8 @@ bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV,
   if (TM.getRelocationModel() != Reloc::Static &&
       TM.getCodeModel() != CodeModel::Large) {
     if (isTargetDarwin()) {
+      if (!isDirectCall)
+        return false;
       bool isDecl = GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode();
       if (GV->hasHiddenVisibility() &&
           (Is64Bit || (!isDecl && !GV->hasCommonLinkage())))
@@ -47,7 +49,7 @@ bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV,
         // target is x86-64 or the symbol is definitely defined in the current
         // translation unit.
         return false;
-      return !isDirectCall && (isDecl || GV->mayBeOverridden());
+      return isDecl || GV->mayBeOverridden();
     } else if (isTargetELF()) {
       // Extra load is needed for all externally visible.
       if (isDirectCall)