[PATCH] D42568: [GlobalISel] Bail out on calls to dllimported functions
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 26 02:47:44 PST 2018
mstorsjo updated this revision to Diff 131563.
mstorsjo retitled this revision from "[AArch64] Don't enable GlobalISel automatically for windows" to "[GlobalISel] Bail out on calls to dllimported functions".
mstorsjo edited the summary of this revision.
mstorsjo added a comment.
Don't skip GlobalISel altogether, but just bail out on dllimport function calls.
https://reviews.llvm.org/D42568
Files:
lib/CodeGen/GlobalISel/IRTranslator.cpp
test/CodeGen/AArch64/dllimport.ll
Index: test/CodeGen/AArch64/dllimport.ll
===================================================================
--- test/CodeGen/AArch64/dllimport.ll
+++ test/CodeGen/AArch64/dllimport.ll
@@ -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 @@
; 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 @@
}
; CHECK-LABEL: call_internal
-; CHECK: b internal
+; DAG-ISEL: b internal
+; FAST-ISEL: b internal
+; GLOBAL-ISEL: bl internal
Index: lib/CodeGen/GlobalISel/IRTranslator.cpp
===================================================================
--- lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -817,6 +817,10 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42568.131563.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180126/4b209a72/attachment.bin>
More information about the llvm-commits
mailing list