Don't accept globals as matching 'i' constraint
authorDale Johannesen <dalej@apple.com>
Tue, 7 Jul 2009 00:18:49 +0000 (00:18 +0000)
committerDale Johannesen <dalej@apple.com>
Tue, 7 Jul 2009 00:18:49 +0000 (00:18 +0000)
in PIC modes (in accordance with existing comment).
gcc.apple/asm-block-25.c

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

lib/Target/X86/X86ISelLowering.cpp

index 5a6294a211c8a494f1195c3fa45f319e5f324c09..fe60614beb8ac2ece313592b4b2dfd8912b5a698 100644 (file)
@@ -8803,10 +8803,15 @@ void X86TargetLowering::LowerAsmOperandForConstraint(SDValue Op,
           continue;
         }
       }
-      
+
       // Otherwise, this isn't something we can handle, reject it.
       return;
     }
+    // If we require an extra load to get this address, as in PIC mode, we
+    // can't accept it.
+    if (Subtarget->GVRequiresExtraLoad(GA->getGlobal(),
+                                       getTargetMachine(), false))
+      return;
 
     if (hasMemory)
       Op = LowerGlobalAddress(GA->getGlobal(), Op.getDebugLoc(), Offset, DAG);