1# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \
2# RUN:   -stop-after=prologepilog | FileCheck %s
3# Test that the frame lowering emits correct SEH updates for the case without
4# a stack frame (e.g. no callee saved registers, no frame pointer, just locals)
5
6# CHECK:      $sp = frame-setup SUBXri $sp, 16, 0
7# CHECK-NEXT: frame-setup SEH_StackAlloc 16
8# CHECK-NEXT: frame-setup SEH_PrologEnd
9# CHECK:      frame-destroy SEH_EpilogStart
10# CHECK-NEXT: $sp = frame-destroy ADDXri $sp, 16, 0
11# CHECK-NEXT: frame-destroy SEH_StackAlloc 16
12# CHECK-NEXT: frame-destroy SEH_EpilogEnd
13# CHECK-NEXT: RET_ReallyLR implicit killed $w0
14
15--- |
16  target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
17  target triple = "aarch64-unknown-windows-msvc19.11.0"
18
19  ; Function Attrs: noinline nounwind optnone uwtable
20  define dso_local i32 @"?func@@YAHH@Z"(i32 %a) #0 {
21  entry:
22    %a.addr = alloca i32, align 4
23    %b = alloca i32, align 4
24    store i32 %a, i32* %a.addr, align 4
25    store i32 2, i32* %b, align 4
26    %0 = load i32, i32* %b, align 4
27    %1 = load i32, i32* %a.addr, align 4
28    %add = add nsw i32 %0, %1
29    ret i32 %add
30  }
31
32  attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" }
33
34...
35---
36name:            '?func@@YAHH@Z'
37alignment:       4
38exposesReturnsTwice: false
39legalized:       true
40regBankSelected: true
41selected:        true
42failedISel:      false
43tracksRegLiveness: true
44registers:
45liveins:
46frameInfo:
47  isFrameAddressTaken: false
48  isReturnAddressTaken: false
49  hasStackMap:     false
50  hasPatchPoint:   false
51  stackSize:       0
52  offsetAdjustment: 0
53  maxAlignment:    4
54  adjustsStack:    false
55  hasCalls:        false
56  stackProtector:  ''
57  maxCallFrameSize: 0
58  cvBytesOfCalleeSavedRegisters: 0
59  hasOpaqueSPAdjustment: false
60  hasVAStart:      false
61  hasMustTailInVarArgFunc: false
62  localFrameSize:  8
63  savePoint:       ''
64  restorePoint:    ''
65fixedStack:
66stack:
67  - { id: 0, name: a.addr, type: default, offset: 0, size: 4, alignment: 4,
68      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
69      local-offset: -4, debug-info-variable: '', debug-info-expression: '',
70      debug-info-location: '' }
71  - { id: 1, name: b, type: default, offset: 0, size: 4, alignment: 4,
72      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
73      local-offset: -8, debug-info-variable: '', debug-info-expression: '',
74      debug-info-location: '' }
75constants:
76body:             |
77  bb.1.entry:
78    liveins: $w0
79
80    renamable $w8 = MOVi32imm 2
81    STRWui killed renamable $w0, %stack.0.a.addr, 0 :: (store 4 into %ir.a.addr)
82    STRWui killed renamable $w8, %stack.1.b, 0 :: (store 4 into %ir.b)
83    renamable $w8 = LDRWui %stack.1.b, 0 :: (load 4 from %ir.b)
84    renamable $w0 = LDRWui %stack.0.a.addr, 0 :: (load 4 from %ir.a.addr)
85    renamable $w0 = nsw ADDWrr killed renamable $w8, killed renamable $w0
86    RET_ReallyLR implicit killed $w0
87
88...
89