From 94b59240e22f97fa955fb4c6db05575469711110 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Sat, 18 Nov 2017 06:23:48 +0000 Subject: [PATCH] [X86] Output cfi directives for saved XMM registers even if no GPRs are saved This makes sure that functions that only clobber xmm registers (on win64) also get the right cfi directives, if dwarf exceptions are enabled. Differential Revision: https://reviews.llvm.org/D40191 llvm-svn: 318591 --- llvm/lib/Target/X86/X86FrameLowering.cpp | 3 +-- llvm/test/CodeGen/X86/cfi-xmm.ll | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 llvm/test/CodeGen/X86/cfi-xmm.ll diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp index c7af0ae..ead877a 100644 --- a/llvm/lib/Target/X86/X86FrameLowering.cpp +++ b/llvm/lib/Target/X86/X86FrameLowering.cpp @@ -1436,8 +1436,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, } // Emit DWARF info specifying the offsets of the callee-saved registers. - if (PushedRegs) - emitCalleeSavedFrameMoves(MBB, MBBI, DL); + emitCalleeSavedFrameMoves(MBB, MBBI, DL); } // X86 Interrupt handling function cannot assume anything about the direction diff --git a/llvm/test/CodeGen/X86/cfi-xmm.ll b/llvm/test/CodeGen/X86/cfi-xmm.ll new file mode 100644 index 0000000..dbb8a61 --- /dev/null +++ b/llvm/test/CodeGen/X86/cfi-xmm.ll @@ -0,0 +1,21 @@ +; RUN: llc -mtriple x86_64-w64-windows-gnu -filetype=asm -exception-model=dwarf -o - %s | FileCheck %s + +define void @_Z1fv() { +entry: + tail call void asm sideeffect "", "~{xmm10},~{xmm15},~{dirflag},~{fpsr},~{flags}"() + ret void +} + +; CHECK-LABEL: _Z1fv: +; CHECK: .cfi_startproc +; CHECK: subq $40, %rsp +; CHECK: movaps %xmm15, 16(%rsp) +; CHECK: movaps %xmm10, (%rsp) +; CHECK: .cfi_def_cfa_offset 48 +; CHECK: .cfi_offset %xmm10, -48 +; CHECK: .cfi_offset %xmm15, -32 +; CHECK: movaps (%rsp), %xmm10 +; CHECK: movaps 16(%rsp), %xmm15 +; CHECK: addq $40, %rsp +; CHECK: retq +; CHECK: .cfi_endproc -- 2.7.4