[llvm] r323811 - [GlobalISel] Bail out on calls to dllimported functions

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 11:50:59 PST 2018


Author: mstorsjo
Date: Tue Jan 30 11:50:58 2018
New Revision: 323811

URL: http://llvm.org/viewvc/llvm-project?rev=323811&view=rev
Log:
[GlobalISel] Bail out on calls to dllimported functions

Differential Revision: https://reviews.llvm.org/D42568

Modified:
    llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
    llvm/trunk/test/CodeGen/AArch64/dllimport.ll

Modified: llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp?rev=323811&r1=323810&r2=323811&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp Tue Jan 30 11:50:58 2018
@@ -817,6 +817,10 @@ bool IRTranslator::translateCall(const U
   auto TII = MF->getTarget().getIntrinsicInfo();
   const Function *F = CI.getCalledFunction();
 
+  // FIXME: support Windows dllimport function calls.
+  if (F && F->hasDLLImportStorageClass())
+    return false;
+
   if (CI.isInlineAsm())
     return translateInlineAsm(CI, MIRBuilder);
 

Modified: llvm/trunk/test/CodeGen/AArch64/dllimport.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/dllimport.ll?rev=323811&r1=323810&r2=323811&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/dllimport.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/dllimport.ll Tue Jan 30 11:50:58 2018
@@ -1,5 +1,6 @@
 ; RUN: llc -mtriple aarch64-unknown-windows-msvc -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,DAG-ISEL
 ; RUN: llc -mtriple aarch64-unknown-windows-msvc -fast-isel -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,FAST-ISEL
+; RUN: llc -mtriple aarch64-unknown-windows-msvc -O0 -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,GLOBAL-ISEL,GLOBAL-ISEL-FALLBACK
 
 @var = external dllimport global i32
 @ext = external global i32
@@ -27,6 +28,8 @@ define i32 @get_ext() {
 ; DAG-ISEL: ldr w0, [x8, ext]
 ; FAST-ISEL: add x8, x8, ext
 ; FAST-ISEL: ldr w0, [x8]
+; GLOBAL-ISEL-FALLBACK: add x8, x8, ext
+; GLOBAL-ISEL-FALLBACK: ldr w0, [x8]
 ; CHECK: ret
 
 define i32* @get_var_pointer() {
@@ -54,4 +57,6 @@ define i32 @call_internal() {
 }
 
 ; CHECK-LABEL: call_internal
-; CHECK: b internal
+; DAG-ISEL: b internal
+; FAST-ISEL: b internal
+; GLOBAL-ISEL: bl internal




More information about the llvm-commits mailing list