summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2014-04-06 10:01:23 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2014-04-06 10:01:23 +0000
commit2e858fcaad72d7b6ed994436e25af083ee5ecde2 (patch)
tree995645c58b4f7dcc2b412bababae6797d122d3a7
parentcde97ea514e4b3a4c9c23db1cee865e8b188b426 (diff)
downloadllvm-2e858fcaad72d7b6ed994436e25af083ee5ecde2.tar.gz
llvm-2e858fcaad72d7b6ed994436e25af083ee5ecde2.tar.bz2
llvm-2e858fcaad72d7b6ed994436e25af083ee5ecde2.tar.xz
Quick fix: Triple::isOSMSVCRT() should be false for targeting cygwin.
It affected callee's stack pop in x86. It is one of devergences between cygwin and mingw since mingw-gcc-4.6. Added testcases to llvm/test/CodeGen/X86/win32_sret.ll for cygwin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205688 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/ADT/Triple.h2
-rw-r--r--test/CodeGen/X86/win32_sret.ll23
2 files changed, 24 insertions, 1 deletions
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
index 185003dc65..a8739650f4 100644
--- a/include/llvm/ADT/Triple.h
+++ b/include/llvm/ADT/Triple.h
@@ -362,7 +362,7 @@ public:
/// \brief Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
bool isOSMSVCRT() const {
- return getOS() == Triple::Win32 || getOS() == Triple::MinGW32;
+ return isWindowsMSVCEnvironment() || isWindowsGNUEnvironment();
}
/// \brief Tests whether the OS is Windows.
diff --git a/test/CodeGen/X86/win32_sret.ll b/test/CodeGen/X86/win32_sret.ll
index d8ecd44d11..ca49051bd2 100644
--- a/test/CodeGen/X86/win32_sret.ll
+++ b/test/CodeGen/X86/win32_sret.ll
@@ -2,9 +2,11 @@
; some setups (e.g., Atom) from affecting the output.
; RUN: llc < %s -mcpu=core2 -mtriple=i686-pc-win32 | FileCheck %s -check-prefix=WIN32
; RUN: llc < %s -mcpu=core2 -mtriple=i686-pc-mingw32 | FileCheck %s -check-prefix=MINGW_X86
+; RUN: llc < %s -mcpu=core2 -mtriple=i686-pc-cygwin | FileCheck %s -check-prefix=CYGWIN
; RUN: llc < %s -mcpu=core2 -mtriple=i386-pc-linux | FileCheck %s -check-prefix=LINUX
; RUN: llc < %s -mcpu=core2 -O0 -mtriple=i686-pc-win32 | FileCheck %s -check-prefix=WIN32
; RUN: llc < %s -mcpu=core2 -O0 -mtriple=i686-pc-mingw32 | FileCheck %s -check-prefix=MINGW_X86
+; RUN: llc < %s -mcpu=core2 -O0 -mtriple=i686-pc-cygwin | FileCheck %s -check-prefix=CYGWIN
; RUN: llc < %s -mcpu=core2 -O0 -mtriple=i386-pc-linux | FileCheck %s -check-prefix=LINUX
; The SysV ABI used by most Unixes and Mingw on x86 specifies that an sret pointer
@@ -21,6 +23,9 @@ entry:
; MINGW_X86-LABEL: _sret1:
; MINGW_X86: {{retl$}}
+; CYGWIN-LABEL: _sret1:
+; CYGWIN: retl $4
+
; LINUX-LABEL: sret1:
; LINUX: retl $4
@@ -38,6 +43,9 @@ entry:
; MINGW_X86-LABEL: _sret2:
; MINGW_X86: {{retl$}}
+; CYGWIN-LABEL: _sret2:
+; CYGWIN: retl $4
+
; LINUX-LABEL: sret2:
; LINUX: retl $4
@@ -56,6 +64,9 @@ entry:
; MINGW_X86-LABEL: _sret3:
; MINGW_X86: {{retl$}}
+; CYGWIN-LABEL: _sret3:
+; CYGWIN: retl $4
+
; LINUX-LABEL: sret3:
; LINUX: retl $4
@@ -77,6 +88,9 @@ entry:
; MINGW_X86-LABEL: _sret4:
; MINGW_X86: {{retl$}}
+; CYGWIN-LABEL: _sret4:
+; CYGWIN: retl $4
+
; LINUX-LABEL: sret4:
; LINUX: retl $4
@@ -98,6 +112,7 @@ entry:
ret void
; WIN32-LABEL: {{^}}"?foo@C5@@QAE?AUS5@@XZ":
; MINGW_X86-LABEL: {{^}}"?foo@C5@@QAE?AUS5@@XZ":
+; CYGWIN-LABEL: {{^}}"?foo@C5@@QAE?AUS5@@XZ":
; LINUX-LABEL: {{^}}"?foo@C5@@QAE?AUS5@@XZ":
; The address of the return structure is passed as an implicit parameter.
@@ -115,6 +130,7 @@ entry:
call x86_thiscallcc void @"\01?foo@C5@@QAE?AUS5@@XZ"(%struct.S5* sret %s, %class.C5* %c)
; WIN32-LABEL: {{^}}_call_foo5:
; MINGW_X86-LABEL: {{^}}_call_foo5:
+; CYGWIN-LABEL: {{^}}_call_foo5:
; LINUX-LABEL: {{^}}call_foo5:
@@ -135,6 +151,7 @@ entry:
define void @test6_f(%struct.test6* %x) nounwind {
; WIN32-LABEL: _test6_f:
; MINGW_X86-LABEL: _test6_f:
+; CYGWIN-LABEL: _test6_f:
; LINUX-LABEL: test6_f:
; The %x argument is moved to %ecx. It will be the this pointer.
@@ -145,6 +162,9 @@ define void @test6_f(%struct.test6* %x) nounwind {
; MINGW_X86: movl 8(%ebp), %eax
; MINGW_X86: movl %eax, (%e{{([a-d]x)|(sp)}})
+; CYGWIN: movl 8(%ebp), %eax
+; CYGWIN: movl %eax, (%e{{([a-d]x)|(sp)}})
+
; The sret pointer is (%esp)
; WIN32: leal 8(%esp), %[[REG:e[a-d]x]]
; WIN32-NEXT: movl %[[REG]], (%e{{([a-d]x)|(sp)}})
@@ -153,6 +173,9 @@ define void @test6_f(%struct.test6* %x) nounwind {
; MINGW_X86-NEXT: leal 8(%esp), %ecx
; MINGW_X86-NEXT: calll _test6_g
+; CYGWIN-NEXT: leal 8(%esp), %ecx
+; CYGWIN-NEXT: calll _test6_g
+
%tmp = alloca %struct.test6, align 4
call x86_thiscallcc void @test6_g(%struct.test6* sret %tmp, %struct.test6* %x)
ret void