fix fastisel to handle GS and FS relative pointers. Patch by
authorChris Lattner <sabre@nondot.org>
Tue, 15 Jun 2010 19:08:40 +0000 (19:08 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 15 Jun 2010 19:08:40 +0000 (19:08 +0000)
Nelson Elhage!

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

lib/Target/X86/X86FastISel.cpp
test/CodeGen/X86/2010-06-14-fast-isel-fs-load.ll [new file with mode: 0644]

index 47ee820b286001165368a7fae291de64693cb4cc..553e9b116aa2b499dc81a2a8f84187ee9127287f 100644 (file)
@@ -349,6 +349,11 @@ bool X86FastISel::X86SelectAddress(const Value *V, X86AddressMode &AM) {
     U = C;
   }
 
+  if (const PointerType *Ty = dyn_cast<PointerType>(V->getType()))
+    if (Ty->getAddressSpace() > 255)
+      // Fast instruction selection doesn't support pointers through %fs or %gs
+      return false;
+
   switch (Opcode) {
   default: break;
   case Instruction::BitCast:
diff --git a/test/CodeGen/X86/2010-06-14-fast-isel-fs-load.ll b/test/CodeGen/X86/2010-06-14-fast-isel-fs-load.ll
new file mode 100644 (file)
index 0000000..b22a391
--- /dev/null
@@ -0,0 +1,6 @@
+; RUN: llc -fast-isel -march=x86 < %s | grep %fs:
+
+define i32 @test1(i32 addrspace(257)* %arg) nounwind {
+       %tmp = load i32 addrspace(257)* %arg
+       ret i32 %tmp
+}