Functions that are lazily streamed in from the .bc file are *not* external.
authorChris Lattner <sabre@nondot.org>
Sun, 29 Jan 2006 20:49:17 +0000 (20:49 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 29 Jan 2006 20:49:17 +0000 (20:49 +0000)
This fixes llvm-test/SingleSource/UnitTests/2006-01-29-SimpleIndirectCall.c
and PR704

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

lib/Target/PowerPC/PPCCodeEmitter.cpp
lib/Target/PowerPC/PPCISelLowering.cpp

index d9d854bbfa47a8b3980e6c5e9de548711344f1c6..8fd9a2957ee3a27a1256cbdc1b37a07e15f6004f 100644 (file)
@@ -196,7 +196,8 @@ int PPCCodeEmitter::getMachineOpValue(MachineInstr &MI, MachineOperand &MO) {
     bool isExternal = MO.isExternalSymbol() ||
                       MO.getGlobal()->hasWeakLinkage() ||
                       MO.getGlobal()->hasLinkOnceLinkage() ||
-                      MO.getGlobal()->isExternal();
+                      (MO.getGlobal()->isExternal() &&
+                       !MO.getGlobal()->hasNotBeenReadFromBytecode());
     unsigned Reloc = 0;
     if (MI.getOpcode() == PPC::BL)
       Reloc = PPC::reloc_pcrel_bx;
index 2c3a07288965229d08ea5bdfbea452e4c7a3b082..3e8214a0574d61ae9ed635eaab3afbddf7755df9 100644 (file)
@@ -437,7 +437,8 @@ SDOperand PPCTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
     SDOperand Lo = DAG.getNode(PPCISD::Lo, MVT::i32, GA, Zero);
     Lo = DAG.getNode(ISD::ADD, MVT::i32, Hi, Lo);
                                    
-    if (!GV->hasWeakLinkage() && !GV->hasLinkOnceLinkage() && !GV->isExternal())
+    if (!GV->hasWeakLinkage() && !GV->hasLinkOnceLinkage() &&
+        (!GV->isExternal() || GV->hasNotBeenReadFromBytecode()))
       return Lo;
 
     // If the global is weak or external, we have to go through the lazy