From 874c92bd47797c7b7ba4dc46b8d7c6d6bf477972 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 15 Jun 2010 19:08:40 +0000 Subject: [PATCH] fix fastisel to handle GS and FS relative pointers. Patch by Nelson Elhage! llvm-svn: 106031 --- llvm/lib/Target/X86/X86FastISel.cpp | 5 +++++ llvm/test/CodeGen/X86/2010-06-14-fast-isel-fs-load.ll | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 llvm/test/CodeGen/X86/2010-06-14-fast-isel-fs-load.ll diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp index 47ee820b2860..553e9b116aa2 100644 --- a/llvm/lib/Target/X86/X86FastISel.cpp +++ b/llvm/lib/Target/X86/X86FastISel.cpp @@ -349,6 +349,11 @@ bool X86FastISel::X86SelectAddress(const Value *V, X86AddressMode &AM) { U = C; } + if (const PointerType *Ty = dyn_cast(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/llvm/test/CodeGen/X86/2010-06-14-fast-isel-fs-load.ll b/llvm/test/CodeGen/X86/2010-06-14-fast-isel-fs-load.ll new file mode 100644 index 000000000000..b22a391ef358 --- /dev/null +++ b/llvm/test/CodeGen/X86/2010-06-14-fast-isel-fs-load.ll @@ -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 +}