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: str x30, [sp, #-16]! 26 %res = call i32 @bar() 27 %res1 = add i32 %res, 1 28 ; CHECK: ldr x30, [sp], #16 29 ; CHECK: ldr x30, [x18, #-8]! 30 ; CHECK: ret 31 ret i32 %res 32} 33 34define i32 @f4() shadowcallstack { 35 ; CHECK: f4: 36 %res1 = call i32 @bar() 37 %res2 = call i32 @bar() 38 %res3 = call i32 @bar() 39 %res4 = call i32 @bar() 40 %res12 = add i32 %res1, %res2 41 %res34 = add i32 %res3, %res4 42 %res1234 = add i32 %res12, %res34 43 ; CHECK: ldp {{.*}}x30, [sp 44 ; CHECK: ldr x30, [x18, #-8]! 45 ; CHECK: ret 46 ret i32 %res1234 47} 48