summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2011-02-21 04:50:06 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2011-02-21 04:50:06 +0000
commitd64cfe1506daf95483549e7347098fbf1a978097 (patch)
tree3480ceba94e4594a1de875aff18dc9eab0002dc4
parent58269b973256bf2436cac0f047aa277fe4bc01dd (diff)
downloadllvm-d64cfe1506daf95483549e7347098fbf1a978097.tar.gz
llvm-d64cfe1506daf95483549e7347098fbf1a978097.tar.bz2
llvm-d64cfe1506daf95483549e7347098fbf1a978097.tar.xz
Target/X86/X86FastISel: [PR6275] Fix Win32's dllimport function with fastisel.
"dllimport" function must not be GlobalVariable, but Function. It is enough to check with GlobalValue. test/CodeGen/X86/dll-linkage.ll is updated to check llc -O0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126110 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86FastISel.cpp8
-rw-r--r--test/CodeGen/X86/dll-linkage.ll5
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/Target/X86/X86FastISel.cpp b/lib/Target/X86/X86FastISel.cpp
index 9d42ac2e47..6fa928462b 100644
--- a/lib/Target/X86/X86FastISel.cpp
+++ b/lib/Target/X86/X86FastISel.cpp
@@ -597,9 +597,13 @@ bool X86FastISel::X86SelectCallAddress(const Value *V, X86AddressMode &AM) {
(AM.Base.Reg != 0 || AM.IndexReg != 0))
return false;
- // Can't handle TLS or DLLImport.
+ // Can't handle DLLImport.
+ if (GV->hasDLLImportLinkage())
+ return false;
+
+ // Can't handle TLS.
if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV))
- if (GVar->isThreadLocal() || GVar->hasDLLImportLinkage())
+ if (GVar->isThreadLocal())
return false;
// Okay, we've committed to selecting this global. Set up the basic address.
diff --git a/test/CodeGen/X86/dll-linkage.ll b/test/CodeGen/X86/dll-linkage.ll
index 9136175852..a0c2a54a99 100644
--- a/test/CodeGen/X86/dll-linkage.ll
+++ b/test/CodeGen/X86/dll-linkage.ll
@@ -1,9 +1,14 @@
; RUN: llc < %s -mtriple=i386-pc-mingw32 | FileCheck %s
+; RUN: llc < %s -mtriple=i386-pc-mingw32 -O0 | FileCheck %s -check-prefix=FAST
+; PR6275
+
declare dllimport void @foo()
define void @bar() nounwind {
; CHECK: calll *__imp__foo
+; FAST: movl __imp__foo, [[R:%[a-z]{3}]]
+; FAST: calll *[[R]]
call void @foo()
ret void
}