[llvm-commits] [llvm] r126110 - in /llvm/trunk: lib/Target/X86/X86FastISel.cpp test/CodeGen/X86/dll-linkage.ll

NAKAMURA Takumi geek4civic at gmail.com
Sun Feb 20 20:50:07 PST 2011


Author: chapuni
Date: Sun Feb 20 22:50:06 2011
New Revision: 126110

URL: http://llvm.org/viewvc/llvm-project?rev=126110&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/Target/X86/X86FastISel.cpp
    llvm/trunk/test/CodeGen/X86/dll-linkage.ll

Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=126110&r1=126109&r2=126110&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Sun Feb 20 22:50:06 2011
@@ -597,9 +597,13 @@
         (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.

Modified: llvm/trunk/test/CodeGen/X86/dll-linkage.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dll-linkage.ll?rev=126110&r1=126109&r2=126110&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/dll-linkage.ll (original)
+++ llvm/trunk/test/CodeGen/X86/dll-linkage.ll Sun Feb 20 22:50:06 2011
@@ -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
 }





More information about the llvm-commits mailing list