From 9cdd2152b92703bfac118f7cc0b3eb934b95cdaf Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Thu, 18 Jul 2019 00:26:03 +0000 Subject: [PATCH] [Tests] Add a test showing how we handle overaligned allocas w/ no-realign-stack (At the moment, we ignore the alignment requirement.) llvm-svn: 366393 --- llvm/test/CodeGen/X86/alloca-overaligned.ll | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 llvm/test/CodeGen/X86/alloca-overaligned.ll diff --git a/llvm/test/CodeGen/X86/alloca-overaligned.ll b/llvm/test/CodeGen/X86/alloca-overaligned.ll new file mode 100644 index 0000000..8ac50d8 --- /dev/null +++ b/llvm/test/CodeGen/X86/alloca-overaligned.ll @@ -0,0 +1,55 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=skylake | FileCheck %s + +declare void @capture(i64*) + +define void @test_natural() "no-realign-stack" { +; CHECK-LABEL: test_natural: +; CHECK: # %bb.0: +; CHECK-NEXT: pushq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: movq %rsp, %rdi +; CHECK-NEXT: callq capture +; CHECK-NEXT: popq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: retq + %a = alloca i64 + call void @capture(i64* %a) + ret void +} + +define void @test_realign() { +; CHECK-LABEL: test_realign: +; CHECK: # %bb.0: +; CHECK-NEXT: pushq %rbp +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: .cfi_offset %rbp, -16 +; CHECK-NEXT: movq %rsp, %rbp +; CHECK-NEXT: .cfi_def_cfa_register %rbp +; CHECK-NEXT: andq $-64, %rsp +; CHECK-NEXT: subq $64, %rsp +; CHECK-NEXT: movq %rsp, %rdi +; CHECK-NEXT: callq capture +; CHECK-NEXT: movq %rbp, %rsp +; CHECK-NEXT: popq %rbp +; CHECK-NEXT: .cfi_def_cfa %rsp, 8 +; CHECK-NEXT: retq + %a = alloca i64, align 64 + call void @capture(i64* %a) + ret void +} + +define void @test_norealign() "no-realign-stack" { +; CHECK-LABEL: test_norealign: +; CHECK: # %bb.0: +; CHECK-NEXT: pushq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: movq %rsp, %rdi +; CHECK-NEXT: callq capture +; CHECK-NEXT: popq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: retq + %a = alloca i64, align 64 + call void @capture(i64* %a) + ret void +} -- 2.7.4