From 0cb0c78a26935546204d733abdd4ed02d5ee340c Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 4 Jun 2009 02:02:01 +0000 Subject: [PATCH] PR3739, part 1: Disable the red zone on Win64. llvm-svn: 72830 --- llvm/lib/Target/X86/X86RegisterInfo.cpp | 3 ++- llvm/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 llvm/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp index 5af1fb17818d..674be298647f 100644 --- a/llvm/lib/Target/X86/X86RegisterInfo.cpp +++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp @@ -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/llvm/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll b/llvm/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll new file mode 100644 index 000000000000..c628b8affdd9 --- /dev/null +++ b/llvm/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll @@ -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 ; [#uses=1] + ret x86_fp80 %conv +} +