1; RUN: llc -verify-machineinstrs -o - %s -mtriple=aarch64-linux-gnu -mattr=+reserve-x18 | FileCheck %s 2 3define void @f1() shadowcallstack { 4 ; CHECK: f1: 5 ; CHECK-NOT: x18 6 ; CHECK: ret 7 ret void 8} 9 10declare void @foo() 11 12define void @f2() shadowcallstack { 13 ; CHECK: f2: 14 ; CHECK-NOT: x18 15 ; CHECK: b foo 16 tail call void @foo() 17 ret void 18} 19 20declare i32 @bar() 21 22define i32 @f3() shadowcallstack { 23 ; CHECK: f3: 24 ; CHECK: str x30, [x18], #8 25 ; CHECK: .cfi_escape 0x16, 0x12, 0x02, 0x82, 0x78 26 ; CHECK: str x30, [sp, #-16]! 27 %res = call i32 @bar() 28 %res1 = add i32 %res, 1 29 ; CHECK: ldr x30, [sp], #16 30 ; CHECK: ldr x30, [x18, #-8]! 31 ; CHECK: ret 32 ret i32 %res 33} 34 35define i32 @f4() shadowcallstack { 36 ; CHECK: f4: 37 %res1 = call i32 @bar() 38 %res2 = call i32 @bar() 39 %res3 = call i32 @bar() 40 %res4 = call i32 @bar() 41 %res12 = add i32 %res1, %res2 42 %res34 = add i32 %res3, %res4 43 %res1234 = add i32 %res12, %res34 44 ; CHECK: ldp x30,{{.*}}, [sp 45 ; CHECK: ldr x30, [x18, #-8]! 46 ; CHECK: ret 47 ret i32 %res1234 48} 49 50define i32 @f5() shadowcallstack nounwind { 51 ; CHECK: f5: 52 ; CHECK-NOT: .cfi_escape 53 %res = call i32 @bar() 54 %res1 = add i32 %res, 1 55 ret i32 %res 56} 57