PR3739, part 1: Disable the red zone on Win64.
authorEli Friedman <eli.friedman@gmail.com>
Thu, 4 Jun 2009 02:02:01 +0000 (02:02 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 4 Jun 2009 02:02:01 +0000 (02:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72830 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86RegisterInfo.cpp
test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll [new file with mode: 0644]

index 5af1fb17818dbf7474577bc76d4ecea3f5c0e375..674be298647f4820d6281119ef4974a3a7715c3a 100644 (file)
@@ -754,7 +754,8 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
   if (Is64Bit && !DisableRedZone &&
       !needsStackRealignment(MF) &&
       !MFI->hasVarSizedObjects() &&                // No dynamic alloca.
-      !MFI->hasCalls()) {                          // No calls.
+      !MFI->hasCalls() &&                          // No calls.
+      !Subtarget->isTargetWin64()) {               // Win64 has no Red Zone
     uint64_t MinSize = X86FI->getCalleeSavedFrameSize();
     if (hasFP(MF)) MinSize += SlotSize;
     StackSize = std::max(MinSize,
diff --git a/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll b/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll
new file mode 100644 (file)
index 0000000..c628b8a
--- /dev/null
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | llc | grep "subq.*\\\$8, \\\%rsp"
+target triple = "x86_64-mingw64"
+
+define x86_fp80 @a(i64 %x) nounwind readnone {
+entry:
+       %conv = sitofp i64 %x to x86_fp80               ; <x86_fp80> [#uses=1]
+       ret x86_fp80 %conv
+}
+