If the data requires a relocation then don't attempt to
authorEric Christopher <echristo@apple.com>
Thu, 7 Jan 2010 19:45:14 +0000 (19:45 +0000)
committerEric Christopher <echristo@apple.com>
Thu, 7 Jan 2010 19:45:14 +0000 (19:45 +0000)
add it to the constant pool for fast-isel. We already
don't add it for the normal case.

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

lib/Target/X86/X86FastISel.cpp

index 10fba2461edf122b10423cb36572bec948ba86ed..31ae50e748d85ed09d35a86e85fa4a30c88c1539 100644 (file)
@@ -19,6 +19,7 @@
 #include "X86RegisterInfo.h"
 #include "X86Subtarget.h"
 #include "X86TargetMachine.h"
+#include "llvm/Constant.h"
 #include "llvm/CallingConv.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/GlobalVariable.h"
@@ -1652,6 +1653,12 @@ unsigned X86FastISel::TargetMaterializeConstant(Constant *C) {
     PICBase = X86::RIP;
   }
 
+  // If we've gotten here we need to make sure we don't have a constant
+  // that needs a relocation, because then we shouldn't put it into the
+  // constant pool.
+  if (C->getRelocationInfo() != Constant::NoRelocation)
+    return 0;
+  
   // Create the load from the constant pool.
   unsigned MCPOffset = MCP.getConstantPoolIndex(C, Align);
   unsigned ResultReg = createResultReg(RC);