diff options
author | Derek Schuff <dschuff@google.com> | 2013-06-14 16:15:29 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2013-06-14 16:15:29 +0000 |
commit | 8a0d41e1a649c32e1f0e22c6c201a2e0d8463e30 (patch) | |
tree | a7de62d1e90c8cec19f2fdd9378ebc25ce9f5ce7 /test | |
parent | 80cecc8c6091b03905cdd35c4c374c20ad0702c1 (diff) | |
download | llvm-8a0d41e1a649c32e1f0e22c6c201a2e0d8463e30.tar.gz llvm-8a0d41e1a649c32e1f0e22c6c201a2e0d8463e30.tar.bz2 llvm-8a0d41e1a649c32e1f0e22c6c201a2e0d8463e30.tar.xz |
Make PrologEpilogInserter save/restore all callee saved registers
in functions which call __builtin_unwind_init()
__builtin_unwind_init() is an undocumented gcc intrinsic which has this effect,
and is used in libgcc_eh.
Goes part of the way toward fixing PR8541.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183984 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/ARM/unwind-init.ll | 18 | ||||
-rw-r--r-- | test/CodeGen/X86/unwind-init.ll | 36 |
2 files changed, 54 insertions, 0 deletions
diff --git a/test/CodeGen/ARM/unwind-init.ll b/test/CodeGen/ARM/unwind-init.ll new file mode 100644 index 0000000000..11683d5605 --- /dev/null +++ b/test/CodeGen/ARM/unwind-init.ll @@ -0,0 +1,18 @@ +; RUN: llc -mtriple=armv7-unknown-linux-gnueabi < %s | FileCheck %s +; Check that all callee-saved registers are saved and restored in functions +; that call __builtin_unwind_init(). This is its undocumented behavior in gcc, +; and it is used in compiling libgcc_eh. +; See also PR8541 + +declare void @llvm.eh.unwind.init() + +define void @calls_unwind_init() { + call void @llvm.eh.unwind.init() + ret void +} + +; CHECK: calls_unwind_init: +; CHECK: push {r4, r5, r6, r7, r8, r9, r10, r11, lr} +; CHECK: vpush {d8, d9, d10, d11, d12, d13, d14, d15} +; CHECK: vpop {d8, d9, d10, d11, d12, d13, d14, d15} +; CHECK: pop {r4, r5, r6, r7, r8, r9, r10, r11, pc} diff --git a/test/CodeGen/X86/unwind-init.ll b/test/CodeGen/X86/unwind-init.ll new file mode 100644 index 0000000000..e34178d872 --- /dev/null +++ b/test/CodeGen/X86/unwind-init.ll @@ -0,0 +1,36 @@ +; RUN: llc -mtriple=x86_64-unknown-linux < %s | FileCheck -check-prefix X8664 %s +; RUN: llc -mtriple=i686-unknown-linux < %s | FileCheck -check-prefix X8632 %s +; Check that all callee-saved registers are saved and restored in functions +; that call __builtin_unwind_init(). This is its undocumented behavior in gcc, +; and it is used in compiling libgcc_eh. +; See also PR8541 + +declare void @llvm.eh.unwind.init() + +define void @calls_unwind_init() { + call void @llvm.eh.unwind.init() + ret void +} + +; X8664: calls_unwind_init: +; X8664: pushq %rbp +; X8664: pushq %r15 +; X8664: pushq %r14 +; X8664: pushq %r13 +; X8664: pushq %r12 +; X8664: pushq %rbx +; X8664: popq %rbx +; X8664: popq %r12 +; X8664: popq %r13 +; X8664: popq %r14 +; X8664: popq %r15 + +; X8632: calls_unwind_init: +; X8632: pushl %ebp +; X8632: pushl %ebx +; X8632: pushl %edi +; X8632: pushl %esi +; X8632: popl %esi +; X8632: popl %edi +; X8632: popl %ebx +; X8632: popl %ebp |